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

INREC PARSE used to sort a CSV file


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

New User


Joined: 11 Feb 2022
Posts: 6
Location: ITALY

PostPosted: Fri Feb 11, 2022 4:55 pm
Reply with quote

Hi all,
I have some issues to sort a CSV as input file. This file has LRECL=290 and RECFM=VB.
Here is a little pic about the records:

189660;PF;3;65916;12/07/2016;...continues
371898;PF;20;64883;27/01/2017;...
5928375;PF;10;77093;17/10/2016;...
5183087;PF;104;65337;12/06/2015;...

Now I'd like to have the following output:

0189660;PF;003;65916;12/07/2016;...
0371898;PF;020;64883;27/01/2017;...
5928375;PF;010;77093;17/10/2016;...
5183087;PF;104;65337;12/06/2015;...

I tried to use PGM=SORT and the following sort card in my JCL:

SORT FIELDS=COPY
INREC PARSE=(%00=(ENDBEFR=C';',FIXLEN=7),
%01=(ENDBEFR=C';',FIXLEN=2),
%02=(ENDBEFR=C';',FIXLEN=3)),
BUILD=(%00,%01,%02)
OUTREC BUILD=(1,7,SQZ=(SHIFT=RIGHT),C';',9,2,C';',12,3,
SQZ=(SHIFT=RIGHT),C';',16,274)

But I it gave me a RC=16. Could be a syntax error? Any suggestions? Thanks in adavance.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Fri Feb 11, 2022 5:35 pm
Reply with quote

Please use Code Tags for Code and Data. There is a Button named Code that works as a toggle exactly for this purpose.

Your OUTREC is buggy. Consider using UFF,M11 to format. Send Msgs that you have received in the Job.
Back to top
View user's profile Send private message
aedesy

New User


Joined: 11 Feb 2022
Posts: 6
Location: ITALY

PostPosted: Fri Feb 18, 2022 1:34 pm
Reply with quote

Hi, thanks for your answer. I tried many times and finally I figured that out. This code works perfectly for me:

Code:
INREC PARSE=(%00=(ENDBEFR=C';',FIXLEN=9),             
%01=(ENDBEFR=C';',FIXLEN=2),                           
%02=(ENDBEFR=C';',FIXLEN=3),                           
%03=(SUBPOS=1,FIXLEN=272)),                           
BUILD=(1,4,%00,UFF,M11,LENGTH=9,C';',%01,C';',         
       %02,UFF,M11,LENGTH=3,%03)                       
SORT FIELDS=(15,2,CH,A,19,3,CH,A,21,5,CH,A),SKIPREC=1
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
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
Search our Forums:

Back to Top