|
View previous topic :: View next topic
|
| Author |
Message |
Bindu Akurathi
New User
Joined: 11 Oct 2024 Posts: 4 Location: India
|
|
|
|
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 |
|
 |
enrico-sorichetti
Superior Member

Joined: 14 Mar 2007 Posts: 10900 Location: italy
|
|
| Back to top |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1430 Location: Bamberg, Germany
|
|
|
|
| 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 |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2272 Location: USA
|
|
|
|
| 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 |
|
 |
Bindu Akurathi
New User
Joined: 11 Oct 2024 Posts: 4 Location: India
|
|
|
|
| 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 |
|
 |
Joerg.Findeisen
Senior Member

Joined: 15 Aug 2015 Posts: 1430 Location: Bamberg, Germany
|
|
|
|
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 |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2272 Location: USA
|
|
|
|
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 |
|
 |
sergeyken
Senior Member

Joined: 29 Apr 2008 Posts: 2272 Location: USA
|
|
|
|
| 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 |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|