View previous topic :: View next topic
|
Author |
Message |
Annie P
New User
Joined: 26 Jun 2006 Posts: 7
|
|
|
|
Is Multiple '01' enties possible in FD section? |
|
Back to top |
|
|
Aji
New User
Joined: 03 Feb 2006 Posts: 53 Location: Mumbai
|
|
|
|
hi
The following way it is possible.
fd a-file.
01 print-rec pic x(132).
fd b-file.
01 b-rec.
02 c pic 99.
Regards
Aji Cherian |
|
Back to top |
|
|
shreevamsi
Active User
Joined: 23 Feb 2006 Posts: 305 Location: Hyderabad,India
|
|
|
|
Hi,
Multiple '01' entries is possible in FD
Eg:
FD A-FILE
01 WS-FIRST-RECORD PIC X(132).
05 WS-VAR-CHAR PIC X(32).
05 FILLER PIC X(100).
01 WS-SECOND-RECORD PIC X(132).
05 WS-VAR1-CHAR1 PIC X(20).
05 FILLER PIC X(112).
Based on the requirement you can read/write or whtever needed, use the record format
~Vamsi |
|
Back to top |
|
|
param_rajesh_2001 Warnings : 1 New User
Joined: 23 Jun 2006 Posts: 18 Location: Bangalore
|
|
|
|
Yes , it is possible . when you want to have diffrent record format . you can always delacre Mulitple 01 level records and accress them as per your requiremts .. |
|
Back to top |
|
|
Annie P
New User
Joined: 26 Jun 2006 Posts: 7
|
|
|
|
thank u, for all ur outputs. |
|
Back to top |
|
|
parikshit123
Active User
Joined: 01 Jul 2005 Posts: 269 Location: India
|
|
|
|
Hi,
I am not sure but, multiple 01 entries in a single FD is possible.
Okay,
At the time of writting a record into file, we spacify the 01 level items and that should work fine with files having multiple 01 level items.
But, when we use read statement, where will be the input record be available? Note that there are multiple 01 level items ! |
|
Back to top |
|
|
manisha-s Warnings : 1 New User
Joined: 22 May 2006 Posts: 13
|
|
|
|
multiple
01 entries are used for a given level indicator (FD, or SD) they
represent implicit redefinitions of the same area.
Regards
Manisha |
|
Back to top |
|
|
calspach
New User
Joined: 05 May 2006 Posts: 32 Location: USA
|
|
|
|
parikshit123 wrote: |
But, when we use read statement, where will be the input record be available? Note that there are multiple 01 level items ! |
It will be available in any and all of the ten layouts.
It's best when doing so that you have a record-type field. I generally make it the first byte or two bytes. Then you know that any record with a 1 or 01 in the first two bytes uses your first record layout, 02 uses your second, etc.
I've written a program that actually had the input record redefined 10 times, 10 different layouts. Can be very handy for a billing program or something that has multiple lines of different info. |
|
Back to top |
|
|
lokesh vasanthi
New User
Joined: 19 Aug 2005 Posts: 17 Location: Chennai, India
|
|
|
|
Hi,
Multiple '01' entries possible in FD section
Take a situation if u have a file with header, detail, trailar record all are having different layouts. After reading the file the input record is in all the different layouts.Below is the code for ur understand
FD I-CUSTOMER-INPUT
BLOCK CONTAINS 0 RECORDS
RECORD IS VARYING IN SIZE FROM 252 TO 764
DEPENDING ON I-CUSTOMR-LENGTH
RECORDING V.
01 I-SLS-REC.
05 I-SLS-REC-TYP PIC X(01).
05 SLS-REST PIC X(763).
01 I-QRZ-REC.
05 I-QRZ-REC-TYPE PIC X.
05 FILLER PIC X(184).
05 I-QRZ-SOURCE-CD PIC XX.
05 FILLER PIC X(65).
READ I-CUSTOMER-INPUT
AT END SET WS-EOF TO TRUE
SET WS-FIRST-EOF TO TRUE
NOT AT END
ADD 1 TO WS-FIRST-READ-CNT
MOVE I-SLS-REC TO WS-SLS-REC
IF WS-SLS-REC-TYPE = 'T'
ADD 1 TO WS-RECON-T-CNT
END-IF
END-READ.
Regards,
Nanda |
|
Back to top |
|
|
parikshit123
Active User
Joined: 01 Jul 2005 Posts: 269 Location: India
|
|
|
|
nandakumar selvaraj wrote: |
Hi,
Multiple '01' entries possible in FD section
Take a situation if u have a file with header, detail, trailar record all are having different layouts. After reading the file the input record is in all the different layouts.Below is the code for ur understand
|
Hi Nanda,
At my shop , this situation is genrally taken care by using REDEFINES in file layout rather than having multiple 01 entries.
I will try to test whether multiple 01 entries are possible in COBOL programs. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi,
You can't use redefines at the 01 level in the FD. You MUST use multiple 01s. |
|
Back to top |
|
|
|