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 query to fetch record which has only ... maxsubrat DB2 2 Mon Dec 11, 2017 5:03 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Extract Record using range of Data scorp_rahul23 DFSORT/ICETOOL 3 Wed Nov 15, 2017 11:54 pm
No new posts Squeeze record left so that zeroes ar... Vignesh Sid SYNCSORT 5 Fri Nov 10, 2017 1:40 pm
No new posts Formatting multiple records to a sing... Vignesh Sid SYNCSORT 3 Tue Nov 07, 2017 12:22 pm

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