View previous topic :: View next topic
|
Author |
Message |
S0C7
New User
Joined: 19 May 2006 Posts: 26
|
|
|
|
Hi,
This is what i am looking for:
I have an input file which is a variable length file. I need to know how do i get the length of each record?
If i use LENGTH OF command, it simply returns me the length of the variable declared in my FD (which is of the max. length). This happens for all the records.
The other option might be to use
"PIC X(01) OCCURS DEPENDING ON var-1" clause in my FD.
But how would i know the value of var-1?
Awaiting replies.... |
|
Back to top |
|
|
DavidatK
Active Member
Joined: 22 Nov 2005 Posts: 700 Location: Troy, Michigan USA
|
|
Back to top |
|
|
lokesh vasanthi
New User
Joined: 19 Aug 2005 Posts: 17 Location: Chennai, India
|
|
|
|
Hi,
The below code will give u picture for ur quetion
FD CODE:
-----------
RECORD IS VARYING IN SIZE FROM 252 TO 764
DEPENDING ON I-CUSTOMR-LENGTH
WORIKING STORAGE Declaration for FD section length field
------------------------------------------------------------------
01 WS-FILE-LENGTH.
05 I-CUSTOMR-LENGTH PIC 9(04) VALUE ZEROES.
01 WS-FIELDS.
05 WS-REC-LENGTH PIC 9(04) VALUE ZEROES.
MOVE I-CUSTOMR-LENGTH
TO WS-REC-LENGTH
DISPLAY 'RECORD LENGTH =' WS-T-REC-LENGTH
Since we are not able to directly display the FD field(I-CUSTOMR-LENGTH), we r moving that field into working storage variable and display the working storage variable.
I hope u will understand the above code.
Regards,
Nanda |
|
Back to top |
|
|
|