Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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 Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts To Merge mutliple records into a sing... anandgbe DFSORT/ICETOOL 6 Wed Feb 22, 2017 8:49 am
No new posts Formating the Input file sreekusr DFSORT/ICETOOL 3 Fri Feb 17, 2017 10:40 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us