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

FB to .CSV conversion using sort


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Bindu Akurathi

New User


Joined: 11 Oct 2024
Posts: 4
Location: India

PostPosted: Mon Oct 14, 2024 2:25 pm
Reply with quote

Hi! I have the file with Fb format having data as below, I want to enclose each data element with double quotes ("") and comma between each value for .CSV format conversion.

Input
1014202400:00:35ABCDEFGH1234567890IJKLMNO
OUTPUT
"10142024","00:00:35","ABCDEFGH","1234567890","IJKLMNO".

Please suggest me how can I get the desired output.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10884
Location: italy

PostPosted: Mon Oct 14, 2024 3:05 pm
Reply with quote

www.ibm.com/support/pages/system/files/inline-files/$FILE/sorttrck.pdf

pretty old but still useful
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1329
Location: Bamberg, Germany

PostPosted: Mon Oct 14, 2024 6:24 pm
Reply with quote

Are the fields floating, or is it just fixed lengths as shown? If fixed length, then why not just use BUILD=(p,m, ..), and insert the missing characters?
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2127
Location: USA

PostPosted: Mon Oct 14, 2024 10:52 pm
Reply with quote

Bindu Akurathi wrote:
Hi! I have the file with Fb format having data as below, I want to enclose each data element with double quotes ("") and comma between each value for .CSV format conversion.

Input
Code:
1014202400:00:35ABCDEFGH1234567890IJKLMNO

OUTPUT
Code:
"10142024","00:00:35","ABCDEFGH","1234567890","IJKLMNO"
.

Please suggest me how can I get the desired output.


Advice #1: try to open any SORT manual.

Code:
//SYMNAMES DD  *
DateField,1,10,CH
TimeField,*,8,CH
Letters1,*,8,CH
Digits1,*,10,CH
Letters2,*,7,CH
Sep1,C'"'
Sep2,C'","'
//*
//SYSIN    DD  *
 SORT FIELDS=COPY
 OUTREC BUILD=(Sep1,
               DateField,Sep2,
               TimeField,Sep2,
               Letters1,Sep2,
               Digits1,Sep2,
               Letters2,Sep1)
 END
Back to top
View user's profile Send private message
Bindu Akurathi

New User


Joined: 11 Oct 2024
Posts: 4
Location: India

PostPosted: Tue Oct 15, 2024 7:40 pm
Reply with quote

Thank you all for your suggestions, i did try to do with outrec build, somehow the jcl throwing errors. Finally, i used inrec build =(1,10,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'"', LENGTH=12),C',').....SO on and it gave the result as I wanted
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1329
Location: Bamberg, Germany

PostPosted: Tue Oct 15, 2024 8:15 pm
Reply with quote

It must be DateField,1,8,CH , but works as expected. Don't make your code more complex than necessary.

Remember that NOTHING is thrown in z/OS.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2127
Location: USA

PostPosted: Tue Oct 15, 2024 8:34 pm
Reply with quote

You need to learn how to post messages to forums not insulting other people.

Bindu Akurathi wrote:
Thank you all for your suggestions, i did try to do with outrec build, somehow the jcl throwing errors. Finally, i used
Code:
INREC BUILD=(1,10,JFY=(SHIFT=LEFT,LEAD=C'"',TRAIL=C'"', LENGTH=12),C',')
.....SO on and it gave the result as I wanted


It would be also nice if you:
0) presented here THE EXACT COPY of what you tried, and what you've got?
1) explained what "somehow the jcl throwing errors" stands for?
2) explained what is the goal of using JFY=(...)?
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2127
Location: USA

PostPosted: Tue Oct 15, 2024 8:36 pm
Reply with quote

Joerg.Findeisen wrote:
It must be DateField,1,8,CH , but works as expected. Don't make your code more complex than necessary.

Remember that NOTHING is thrown in z/OS.


Top secret info:
That was the deliberate typo, added to check: if TS can understand the hints rather than full copy-and-paste code samples.
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts JCL sort to compare dates in two file... DFSORT/ICETOOL 2
No new posts Is this possible via sort (in one pass)? SYNCSORT 4
No new posts GDG generation name to GDG Base name ... DFSORT/ICETOOL 3
No new posts SORT on detail record, then repeat he... DFSORT/ICETOOL 3
No new posts SORT CARD meaning please DFSORT/ICETOOL 3
Search our Forums:

Back to Top