MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Variable Length Sequential File

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Data Management
View previous topic :: View next topic  
Author Message
haseen_mohammed
Beginner


Joined: 20 Feb 2006
Posts: 27
Topics: 14

PostPosted: Fri May 30, 2008 10:11 am    Post subject: Variable Length Sequential File Reply with quote

Hi I want to know the length of each record before reading them from a variable length file in a COBOL program

Can you please advise a way forward.

Thanks
Haseen
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Fri May 30, 2008 11:11 am    Post subject: Reply with quote

BEFORE your read?! I do not have a psychic program, sorry. AFTER you read there are ways - not sure what they are in COBOL but in PL/1 you can access the prefix to the record by defining an array over the record an use negative subscripts. Used this in LOCATE mode processing. But COBOL...
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
jsharon1248
Intermediate


Joined: 08 Aug 2007
Posts: 291
Topics: 2
Location: Chicago

PostPosted: Fri May 30, 2008 1:17 pm    Post subject: Reply with quote

I'm like Nic. I don't have a program with predictive abilities either. However, if you're interested in determining the length of variable records in a COBOL program after you read the record, you would use the LENGTH OF function. There are 2 ways to define variable length records (not file; files are variable length by definition). If you coded multiple 01 levels for your FD, you'd issue the LENGTH OF function using whatever FD you've determined that you will use for a particular record. Most likely, there is a record type code variable defined in the same position on all the records which you'd use to identify which 01 level record to use. If you're using a single 01 level in your FD with an OCCURS DEPENDING ON phrase, just issue the LENGTH OF on the 01 level. COBOL will determine the length using the appropriate occurs value populated for the table.
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri May 30, 2008 1:18 pm    Post subject: Reply with quote

there is a 'manuals' link at the top. go to a cobol manual. look for the read variable length. the read command and the FD definition has options like Status, Record Length, etc.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
expat
Intermediate


Joined: 01 Mar 2007
Posts: 475
Topics: 9
Location: Welsh Wales

PostPosted: Sat May 31, 2008 4:14 am    Post subject: Reply with quote

What about IEBPSYCIC Very Happy
_________________
If it's true that we are here to help others,
then what exactly are the others here for ?
Back to top
View user's profile Send private message
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Sat May 31, 2008 9:14 am    Post subject: Reply with quote

Is that (IEBPSYCIC) supported under zOS?

I suppose you could have a record before each record that has the length of the following record on it so you would then know the length of the next record before it is read. Confused
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
expat
Intermediate


Joined: 01 Mar 2007
Posts: 475
Topics: 9
Location: Welsh Wales

PostPosted: Sat Jun 07, 2008 4:19 am    Post subject: Reply with quote

You could use DFSORT to read the file and create a second file with the record lengths of each record and then rewrite the program to use the second input.

Quote:
Is that (IEBPSYCIC) supported under zOS?

Yes, but only release 3.18 or higher
_________________
If it's true that we are here to help others,
then what exactly are the others here for ?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Data Management All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group