View previous topic :: View next topic |
Author |
Message |
haseen_mohammed Beginner
Joined: 20 Feb 2006 Posts: 27 Topics: 14
|
Posted: Fri May 30, 2008 10:11 am Post subject: Variable Length Sequential File |
|
|
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 |
|
|
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Fri May 30, 2008 11:11 am Post subject: |
|
|
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 |
|
|
jsharon1248 Intermediate
Joined: 08 Aug 2007 Posts: 291 Topics: 2 Location: Chicago
|
Posted: Fri May 30, 2008 1:17 pm Post subject: |
|
|
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 |
|
|
dbzTHEdinosauer Supermod
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
|
Posted: Fri May 30, 2008 1:18 pm Post subject: |
|
|
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 |
|
|
expat Intermediate
Joined: 01 Mar 2007 Posts: 475 Topics: 9 Location: Welsh Wales
|
Posted: Sat May 31, 2008 4:14 am Post subject: |
|
|
What about IEBPSYCIC _________________ If it's true that we are here to help others,
then what exactly are the others here for ? |
|
Back to top |
|
|
Nic Clouston Advanced
Joined: 01 Feb 2007 Posts: 1075 Topics: 7 Location: At Home
|
Posted: Sat May 31, 2008 9:14 am Post subject: |
|
|
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. _________________ Utility and Program control cards are NOT, repeat NOT, JCL. |
|
Back to top |
|
|
expat Intermediate
Joined: 01 Mar 2007 Posts: 475 Topics: 9 Location: Welsh Wales
|
Posted: Sat Jun 07, 2008 4:19 am Post subject: |
|
|
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 |
|
|
|
|