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
 
Cobol File Formatting issue

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
moumi das
Warnings : 1

New User


Joined: 21 Dec 2009
Posts: 10
Location: Kolkata

PostPosted: Tue Jun 11, 2013 5:56 pm    Post subject: Cobol File Formatting issue
Reply with quote

My requirement is i have a input file of this format :

a=10,ab=12,ac=100
ab=12,ac=1000,ad=112

Now my output file should be of the format
a|ab|ac|ad

10|12|0100|000
00|12|1000|112

Can anyone help in accomplishing this task with a cobol program?

Thanks,
Moumi
Back to top
View user's profile Send private message

Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1567
Location: Andromeda Galaxy

PostPosted: Tue Jun 11, 2013 6:15 pm    Post subject:
Reply with quote

Could you pleaase explain better?

Could you copy paste some sample data from input and let us know the expected output?

Also please use Code tags

Quote:
Now my output file should be of the format
a|ab|ac|ad

10|12|0100|000
00|12|1000|112


Also how did you arrive at this solution above we need to know the logic/formula behind it
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6970
Location: porcelain throne

PostPosted: Tue Jun 11, 2013 6:23 pm    Post subject:
Reply with quote

are we to assume that there will only be the variables:
A, AB, AC and AD?
and there will only be 3 of the 4 variables in each record?

If so,
UNSTRING each record delimited by ',' (a comma) INTO 3 primary fields.
then unstring each field delimited by '=' (an equals sign) INTO 2 secondary fields.

secondary field 1 would contain the A,AB,AC or AD.
interrogation of each secondary field 1 (there will be 3) would tell which relative numeric field in the output the corresponding secondary field 2 would be placed.
then, STRING
ouput field 1, delimited by size,
'|',
ouput field 2, delimited by size,
'|',
ouput field 3, delimited by size,
'|',
ouput field 4, delimited by size,
INTO output record.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8449
Location: Dubuque, Iowa, USA

PostPosted: Tue Jun 11, 2013 6:37 pm    Post subject:
Reply with quote

Your post is severely lacking in required information for a valid response.

Are the fields always going to be in A=, AB=, AC=, AD= order in the record (if present), or can they appear randomly?
Are the input values always going to be 2, 2, 4, 3 bytes or can they be different lengths? If different lengths, what are the minimum and maximum values?
Do you want the output values to be 2, 2, 4, 3 bytes? What is supposed to happen if any input value exceeds the output length?
Can any values be negative? If so, how are they to be handled (leading sign, trailing sign, ignore sign, sign overlay on the first byte, sign overlay on the last byte are some of the choices)

Finally, asking for code is considered impolite on this forum. What have you coded so far, and what is not working for you? The more you help yourself, the more willing we are to help you.
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 Mainframe to linux file count mismatch shreya19 All Other Mainframe Topics 4 Thu Jun 13, 2019 9:49 pm
No new posts Regarding mroe data to be processed i... vinu78 DB2 1 Mon May 27, 2019 7:31 pm
No new posts Copy physical Tape files to a Mainfra... Dadi Krishna Teja JCL & VSAM 11 Thu May 16, 2019 10:25 pm
No new posts S0C7 abend while running a Cobol Program amitc23 COBOL Programming 2 Tue May 07, 2019 4:06 pm
No new posts How can I close a flat file in Ezytrieve dibyendumandal11111 CA Products 3 Wed Apr 17, 2019 2:19 pm

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