Hi all friend,

Could Any body send me the code (with coding) of this
senario because I have tried but I am stucking somewhere so
Please reply ASAp with coding.

senario:Q: I have to write the flat file(FLAT1) into the
three different PFS (PF1,PF2 and PF3) with the respect of H
line data,
D line data and Z line data of flat file.

where
I have different data in flat file(FLAT1) which is
mentioned below with data.

H0929200909282009092820095529420003000073

D2222220006765555webservi001633.9909222009092820090924200951
8564380134049ROSNER TOYOTA OF FREDE FREDERICKSBURVA
224080000USA840840001633.99001633.99851856492689800208001915
511001633.990408490000000.0000000003446048
1,3 110793145 09070700351
372367 Rosner Motors

D3333320006774444webservi000271.2409222009092820090924200951
8564380134049ROSNER TOYOTA OF FREDE FREDERICKSBURVA
224080000USA840840000271.24000271.24851856492689800208001835
511000271.240930680000000.0000000003450293
1 110793254 09072100079
373933 Rosner Motors


Z0929200900000020001905.25


FLAT1 has the three pf data
H line-represents the header pf data,D-Represent Details
pf data,Z-Represents the trailer pf data

Now I have to write H line data of flat file into Header pf
(PF1),D line data of flat into datails pf(PF2) and
Z line data of flat file into pf(PF3) with the spefic
position(H,D and Z data of flat file into PF1, PF2 and PF3)
of
flat file.

Answers were Sorted based on User's Feedback



Hi all friend, Could Any body send me the code (with coding) of this senario because I have tri..

Answer / sekhar214

If you observe the data, the first letter of the data contains H,D or Z. Coding should be like this.

H Option (*NoDebugIO)
FFLAT1 IF E DISK Rename(FLAT1:RFLAT) PREFIX(A_)
FPF1 O E DISK
FPF2 O E DISK
FPF3 O E DISK
D
D
D
/FREE
READ FLAT1 ;
DOW NOT %EOF ( FLAT1 ) ;
IF %SUBST(A_FLAT1:1:1) = 'H' ;
WRITE RPF1 ;
ENDIF ;
IF %SUBST(A_FLAT1:1:1) = 'D' ;
WRITE RPF2 ;
ENDIF ;
IF %SUBST(A_FLAT1:1:1) = 'Z' ;
WRITE RPF3 ;
ENDIF ;


READ FLAT1 ;
ENDDO ;

*INLR = *ON ;




/END-FREE
YOU SHOULD HANDLE THE CODE , WHEN WRITING INTO PF1,PF2,PF3.

Is This Answer Correct ?    3 Yes 1 No

Hi all friend, Could Any body send me the code (with coding) of this senario because I have tri..

Answer / syam

Dear

Do you know the field length and data type of the above
data?

Is This Answer Correct ?    1 Yes 0 No

Hi all friend, Could Any body send me the code (with coding) of this senario because I have tri..

Answer / syam

Hi,

You can read flat file on RPG program.
FXXXXXX IF F 380 DISK UC
IXXXXXX DS 01 1 C1
I 1 120AA1
I 13 550AA2
IXXXXXX DS 02 1 C1
I 7 120BB1
I 71 750BB2
IXXXXXX DS 03 1 C1
I 15 120BB3
I 120 1750BB4

Is This Answer Correct ?    1 Yes 0 No

Hi all friend, Could Any body send me the code (with coding) of this senario because I have tri..

Answer / rizwana

Hi Deepakc999,

What Syam saying is correct
Since there are 2 types of flat files available
1. Flat File without DDS (Created through CRTPF Command)
2. Flat file with DDS

Type 1 --> Write
For the first type it is going to have same File name,
record format name & Field name, you have to rename the
REcord format name & Field name first.
To Rename Record format, Rename Keyword of F Spec is used.
And to have the different fields, create a data structure
and link it to the Flat file, there after you can very well
write it to the corresponding Pf.

Type 2 --> Write
Normal like writing to Pf.


For both the types refer to the below links.

1.http://tutorialindia.com/articles/as400/steps-to-process-
flat-file-in-rpg-iv.php

2.http://tutorialindia.com/articles/as400/example-codes-to-
process-flat-file-in-rpgle.php

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More RPG400 Interview Questions

What you have to do in the display file when you are using message subfile?

1 Answers  


How can i check the object existance in RPG program without using QCMDEXC command.

7 Answers   IBM, JDA,


Hi,Please give me complete code with this logic. The question is how to read the records from a file with load an array of size with error condition? (The logic is Z-Add 0 IDX *LOVAL SETLL FILE READ FILE 99 *IN9 DOWEQ *OFF IDX ANDLT 99 ADD 1 IDX MOVE FIELD ARR,IDX READ FILE 99 ENDDO)please give me complete code with explanation?

1 Answers  


What is the difference between iter and do?

0 Answers  


program to find the number of objects used in a given program through a display.

2 Answers   IBM,






How can we change element of compile time array?Can we do so

1 Answers   TCS,


How do you call procedures in ILE?

3 Answers  


what is the necessary command needed before OPNQRYF and why?

5 Answers  


Some times While checking MSGW for object / member / record locks ,I have seen it's locked by itself ...? How it happen and what action we need to perform if job is updating / writing a record....?

6 Answers   HSBC,


Suppose in CL we reach at end of file and again we have to reach from 1 record

3 Answers   TCS,


This is my Physical file 'EMPS' existing in library "TAMIL1" and its record format is 'EMPRCD" a)its source is R EMPRCD ENO 4 0 ENAME 10 EADD 10 b)The records present in EMPS are as follows ENO ENAME EADD 0001 tamil coimbatore 0002 kumar bangalore 0003 sunder bangalore 0004 arunkumar chennai 0005 pandi hyderabad 0006 santhosh hyderabad 0007 sasi salem 0008 kalai chennai 0009 suresh hyderabad 0010 vijay bangalore 0011 Arul chennai 0012 velu chennai 0013 khan bangalore 0014 praba chennai 0015 praba.p coimbatore 0016 anand ooty 0017 raja erode 0018 sankar erode 0019 vadivel namakkal 0020 anbu chennai 0021 Ajith mumabi c)now i want to select the 'ENAME' field records starting with 'S' for that i have created a RPG program its source code is PGM DCLF FILE(TAMIL1/EMPS) DCL VAR(&MYENO) TYPE(*CHAR) LEN(4) OVRDBF FILE(EMPS) SHARE(*YES) OPNQRYF FILE((TAMIL1/EMPS)) QRYSLT('ENAME *EQ %WLDCRD("S *")') READ: RCVF RCDFMT(EMPRCD) MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(END)) CHGVAR VAR(&MYENO) VALUE(&ENO) SNDUSRMSG MSG(&MYENO) SNDUSRMSG MSG(&ENAME) SNDUSRMSG MSG(&EADD) GOTO READ END: CLOF OPNID(EMPS) DLTOVR FILE(EMPS) ENDPGM Is this coding correct sir,the program gets compiled,and if i call it it says query running but records are not displayed.please help me out

4 Answers   Virtusa,


How can we find out whether the job is interactive or Batch through RPG program? 2) How can we find out through CL program?

6 Answers   CSC,


Categories