IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

how to get the length of the input variable length record


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
S0C7

New User


Joined: 19 May 2006
Posts: 26

PostPosted: Fri Jul 14, 2006 1:42 pm
Reply with quote

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.... icon_question.gif
Back to top
View user's profile Send private message
DavidatK

Active Member


Joined: 22 Nov 2005
Posts: 700
Location: Troy, Michigan USA

PostPosted: Sat Jul 15, 2006 2:26 am
Reply with quote

Check the link.

READING VARIABLE LENGTH RECORDS

Use Format 3. data-name-1 will contain the number of bytes read

Dave
Back to top
View user's profile Send private message
lokesh vasanthi

New User


Joined: 19 Aug 2005
Posts: 17
Location: Chennai, India

PostPosted: Sat Jul 15, 2006 3:04 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top