View previous topic :: View next topic
|
Author |
Message |
John Antony
New User
Joined: 01 Aug 2020 Posts: 1 Location: United States
|
|
|
|
Hi all,
I have a specific requirement where in I have to write the COBOL table data into a fixed length flat file which is lesser in the size of the overall table data. But all 2000 byte data should be written into the output. Increasing LRECL of output file is not an option since its a standard layout being used in the application.
Details
Table data is of total length 2000 (80 bytes of data each. Occurs 25 times. )and the output file that has to hold this data is of length 1400. I have to write the entire data into the file using the data from COBOL internal table. COBOL table is passed as linkage to the program where I should be writing the output file. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2022 Location: USA
|
|
|
|
Please, present the results of your own efforts here.
What did you try so far?
What did you get?
What are the results?
What are the error messages (if any)? |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2022 Location: USA
|
|
|
|
P.S.
I’ve never seen in my life a limited size dataset (“file”) which is smaller in size than the “table” in memory… |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3053 Location: NYC,USA
|
|
|
|
Welcome!
You can split each record into two records and write .
You can strip trailing spaces and try managing 1400 bytes ( assuming not all fields are full 80 bytes) and write as one record
You need to talk to consumer of this data as to how they need each record before taking any action.
Would you care to tell us why can’t you expand the LRECL to 2000? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Quote: |
and the output file that has to hold this data is of length 1400. |
unfortunatley a dataset does not have a length
it has a record length for the DCB
and in some cases ( for direct access )
a constraint on the number of records, but it should be handled by the application, data management is not designed for that
It might wiser for the ts start over from scratch trying to describe better the requirement |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2022 Location: USA
|
|
|
|
John Antony wrote: |
Hi all,
I have a specific requirement where in I have to write the COBOL table data into a fixed length flat file which is lesser in the size of the overall table data. But all 2000 byte data should be written into the output. Increasing LRECL of output file is not an option since its a standard layout being used in the application.
Details
Table data is of total length 2000 (80 bytes of data each. Occurs 25 times. )and the output file that has to hold this data is of length 1400. I have to write the entire data into the file using the data from COBOL internal table. COBOL table is passed as linkage to the program where I should be writing the output file. |
You are trying to describe your task using your own terminology, which is fully in conflict with the standard mainframe (and IT in general) terminology.
I don’t know if it is possible to create any COBOL code (or any other code at all) without correct understanding of computer architecture, and especially the dataset organization standards.
Maybe it would be more clear if you presented the real pieces of code you are working with? So far your description looks as if translated from Chinese via Google Translate… |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3053 Location: NYC,USA
|
|
|
|
It’s a simple ask ( though it doesn’t make no sense ). TS wants to write 2000 bytes of a record or work area as an array into 1400 bytes (LRECL=1400). And the options are to split into two records or strip off spaces from each occurrence to see if it fits 1400 bytes. What is it that not understood from the TS ask? |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2022 Location: USA
|
|
|
|
Rohit Umarjikar wrote: |
It’s a simple ask ( though it doesn’t make no sense ). TS wants to write 2000 bytes of a record or work area as an array into 1400 bytes (LRECL=1400). And the options are to split into two records or strip off spaces from each occurrence to see if it fits 1400 bytes. What is it that not understood from the TS ask? |
This is literally what TS wants:
Quote: |
Table data is of total length 2000 (80 bytes of data each. Occurs 25 times. )and the output file that has to hold this data is of length 1400 |
It has nothing to do with your own interpretation of his message.
To say nothing (again, and again) about no such thing as "file" in mainframe...
P.S.
I'm not sure what for a "file size" the TS mentioned; it may be:
- maximum allowed size of dataset on the drive?
- maximum (or fixed) LRECL?
- maximum (or fixed?) BLKSIZE?
Rather I'm sure the TS has not a minor idea yet about these entities... |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3053 Location: NYC,USA
|
|
|
|
Quote: |
To say nothing (again, and again) about no such thing as "file" in mainframe... |
It does not make difference. This has been discussed , debated on this forum and one can use both , its a individual choice , so leave it at there.
Quote: |
It has nothing to do with your own interpretation of his message. |
Its not a rocket science to guess , wait for TS to reply.
Quote: |
Rather I'm sure the TS has not a minor idea yet about these entities... |
How do you know?
Quote: |
I'm not sure what for a "file size" the TS mentioned; it may be:
- maximum allowed size of dataset on the drive?
- maximum (or fixed) LRECL?
- maximum (or fixed?) BLKSIZE? |
If you needed this any info which you have asked already , why are you not waiting for TS to reply but talk everything else other than the topic itself which has no relevance at all but to judge a person on its ability? |
|
Back to top |
|
|
jasorn Warnings : 1 Active User
Joined: 12 Jul 2006 Posts: 191 Location: USA
|
|
|
|
One other option would be to truncate anything after byte 1400.
Oops! OP stated all 2000 bytes need to be written. So this is not an option. |
|
Back to top |
|
|
|