IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

COBOL Table data to a flat file with lesser record length


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
John Antony

New User


Joined: 01 Aug 2020
Posts: 1
Location: United States

PostPosted: Wed Jun 16, 2021 2:12 am
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2022
Location: USA

PostPosted: Wed Jun 16, 2021 4:40 am
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2022
Location: USA

PostPosted: Wed Jun 16, 2021 4:52 am
Reply with quote

P.S.
I’ve never seen in my life a limited size dataset (“file”) which is smaller in size than the “table” in memory… icon_question.gif icon_redface.gif icon_mad.gif
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Wed Jun 16, 2021 5:59 pm
Reply with quote

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
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Jun 16, 2021 6:21 pm
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2022
Location: USA

PostPosted: Wed Jun 16, 2021 6:38 pm
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Sun Jun 20, 2021 10:41 pm
Reply with quote

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
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2022
Location: USA

PostPosted: Mon Jun 21, 2021 5:18 pm
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Mon Jun 21, 2021 6:45 pm
Reply with quote

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
View user's profile Send private message
jasorn
Warnings : 1

Active User


Joined: 12 Jul 2006
Posts: 191
Location: USA

PostPosted: Sun Oct 17, 2021 8:11 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Store the data for fixed length COBOL Programming 1
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
Search our Forums:

Back to Top