Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
how to get the length of the input variable length record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: how to get the length of the input variable length record
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    Post subject: Re: how to get the length of the input variable length recor
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    Post subject: Re: how to get the length of the input variable length recor
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
This topic is locked: you cannot edit posts or make replies. Selecting two copybooks of different ... Vignesh Sid COBOL Programming 8 Tue Sep 05, 2017 7:28 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts SORT Trailer Count - LRECL Output co... amorante DFSORT/ICETOOL 5 Tue Aug 29, 2017 8:57 pm
No new posts Repeat part of record multiple times Learncoholic DFSORT/ICETOOL 4 Tue Aug 29, 2017 11:33 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us