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

Parsing more than 1000 columns in a sort card


IBM Mainframe Forums -> SYNCSORT
Post new topic   This topic is locked: you cannot edit posts or make replies.
View previous topic :: View next topic  
Author Message
ssuthagar

New User


Joined: 03 Oct 2017
Posts: 6
Location: United States

PostPosted: Tue Sep 22, 2020 12:23 am
Reply with quote

Hi Seniors,

My requirement is to parse CSV file with 1020 columns and I know that I can parse only 1000 columns in a sort card.

It is a VB file since the data may not be available for all columns but the delimiters are available.

I would really appreciate if someone can help me to resolve this situation.

Note: - I am trying to split a file based on delimiter with 1000 columns.

Thanks,
Suthagar
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Tue Sep 22, 2020 1:01 am
Reply with quote

You can try processing in two passes with JOINKEYS (F1 and F2 have exactly the same input). See the following sample:
Code:
//PARSEMAX EXEC PGM=SORT                                               
//F1       DD *                                                         
A;B;C;D;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;X;Y;Z;0;1;2;3;4;5;6;7;
/*                                                                     
//F2       DD *                                                         
A;B;C;D;E;F;G;H;I;J;K;L;M;N;O;P;Q;R;S;T;U;V;W;X;Y;Z;0;1;2;3;4;5;6;7;
/*                                                                     
//SORTOUT  DD SYSOUT=*                                                 
//SYSOUT   DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  OPTION COPY                                                           
  JOINKEYS F1=F1,FIELDS=(81,8,A),TYPE=V,SORTED                         
  JOINKEYS F2=F2,FIELDS=(81,8,A),TYPE=V,SORTED                         
  JOIN UNPAIRED                                                         
  REFORMAT FIELDS=(F1:1,34,F2:1,34)                                     
  END                                                                   
/*                                                                     
//JNF1CNTL DD *                                                         
  INREC IFTHEN=(WHEN=INIT,                                             
    PARSE=(%000=(ENDBEFR=C';',FIXLEN=2,REPEAT=17)),                     
    BUILD=(%000,                                                       
           %001,                                                       
           %002,                                                       
           %003,                                                       
           %004,                                                       
           %005,                                                       
           %006,                                                       
           %007,                                                       
           %008,                                                       
           %009,                                                       
           %010,                                                       
           %011,                                                       
           %012,                                                       
           %013,                                                       
           %014,                                                       
           %015,                                                       
           %016,                                                       
           81:SEQNUM,8,ZD))                                             
  END                                                   
/*                                                     
//JNF2CNTL DD *                                         
  INREC IFTHEN=(WHEN=INIT,                             
    PARSE=(%=(ABSPOS=35),                               
           %000=(ENDBEFR=C';',FIXLEN=2,REPEAT=17)),     
    BUILD=(%000,                                       
           %001,                                       
           %002,                                       
           %003,                                       
           %004,                                       
           %005,                                       
           %006,                                       
           %007,                                       
           %008,                                       
           %009,                                       
           %010,                                       
           %011,                                       
           %012,                                       
           %013,                                       
           %014,                                       
           %015,                                       
           %016,                                       
           81:SEQNUM,8,ZD))                             
  END                                                   
/*

Output:
Code:
****** **************************** Datenanfang **************************
000001 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7
****** **************************** Datenende ****************************
Back to top
View user's profile Send private message
ssuthagar

New User


Joined: 03 Oct 2017
Posts: 6
Location: United States

PostPosted: Tue Sep 22, 2020 1:31 am
Reply with quote

Thanks Jeorg,

Actually mine is a single CSV file which contains 1020 columns, With headers are detailed records and all are delimited by ",".

Detail records will not have a value for all 1020 columns and I need to parse it out to its positions to process.

I am really sorry, I am not getting your response for my question.

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

Senior Member


Joined: 29 Apr 2008
Posts: 2011
Location: USA

PostPosted: Tue Sep 22, 2020 1:54 am
Reply with quote

Joerg.Findeisen wrote:
You can try processing in two passes with JOINKEYS (F1 and F2 have exactly the same input). See the following sample:
Code:
                           
    PARSE=(%=(ABSPOS=35),                               

“Some fields can be missing” <-> fixed position will not work...
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2011
Location: USA

PostPosted: Tue Sep 22, 2020 2:02 am
Reply with quote

ssuthagar wrote:
Thanks Jeorg,

Actually mine is a single CSV file which contains 1020 columns, With headers are detailed records and all are delimited by ",".

Detail records will not have a value for all 1020 columns and I need to parse it out to its positions to process.

I am really sorry, I am not getting your response for my question.

Thanks,
Suthagar

The answer by Joerg is clear enough for the Expert Forum.
Since it doesn’t work for you, I recommend to move your discussion to the Beginners Forum.
Back to top
View user's profile Send private message
ssuthagar

New User


Joined: 03 Oct 2017
Posts: 6
Location: United States

PostPosted: Tue Sep 22, 2020 2:10 am
Reply with quote

Thanks for your response Sergeyken,

I did not see the beginners forum in Home. Can you please share the link for the beginners forum.

Thanks in advance,
Suthagar
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2011
Location: USA

PostPosted: Tue Sep 22, 2020 2:14 am
Reply with quote

ssuthagar wrote:
Thanks for your response Sergeyken,

I did not see the beginners forum in Home. Can you please share the link for the beginners forum.

Thanks in advance,
Suthagar


www.ibmmainframeforum.com/
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


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

PostPosted: Tue Sep 22, 2020 2:43 am
Reply with quote

sergeyken wrote:
Joerg.Findeisen wrote:
You can try processing in two passes with JOINKEYS (F1 and F2 have exactly the same input). See the following sample:
Code:
                           
    PARSE=(%=(ABSPOS=35),

“Some fields can be missing” <-> fixed position will not work...

Yes, that's true.

Another quick update to parse 6 fields each to FIXLEN=8, in two passes:
Code:
//PARSEMAX EXEC PGM=SORT                                 
//F1       DD *                                           
Any Data,or,none,at,all,,this, will,work.,2020,09,21     
/*                                                       
//F2       DD *                                           
Any Data,or,none,at,all,,this, will,work.,2020,09,21     
/*                                                       
//SORTOUT  DD SYSOUT=*                                   
//SYSOUT   DD SYSOUT=*                                   
//SYSIN    DD *                                           
  OPTION COPY                                             
  JOINKEYS F1=F1,FIELDS=(129,8,A),TYPE=V,SORTED           
  JOINKEYS F2=F2,FIELDS=(129,8,A),TYPE=V,SORTED           
  JOIN UNPAIRED                                           
  REFORMAT FIELDS=(F1:1,128)                             
  INREC IFTHEN=(WHEN=INIT,                               
    PARSE=(%=(ABSPOS=50),                                 
           %000=(ENDBEFR=C',',FIXLEN=8,REPEAT=6)),       
    BUILD=(1,48,%000,%001,%002,%003,%004,%005))           
  END                                                     
/*                                                       
//JNF1CNTL DD *                                           
  INREC IFTHEN=(WHEN=INIT,                               
    PARSE=(%000=(ENDBEFR=C',',FIXLEN=8,REPEAT=6),         
           %999=(SUBPOS=1,FIXLEN=80)),                   
    BUILD=(%000,%001,%002,%003,%004,%005,%999,           
           129:SEQNUM,8,ZD))                             
  END                                                     
/*                                                       
//JNF2CNTL DD *                                           
  INREC IFTHEN=(WHEN=INIT,BUILD=(129:SEQNUM,8,ZD))       
  END                                                     
/*

Output:
Code:
****** **************************** Datenanfang ********************************************************
000001 Any Dataor      none    at      all             this     will   work.   2020    09      21       
****** **************************** Datenende **********************************************************

It could be done with two separate steps as well.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


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

PostPosted: Tue Sep 22, 2020 11:25 pm
Reply with quote

What makes you not write a COBOL program ?
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2011
Location: USA

PostPosted: Tue Sep 22, 2020 11:30 pm
Reply with quote

Rohit Umarjikar wrote:
What makes you not write a COBOL program ?

My personal reason not to use COBOL whenever possible:

In average 30-50 pages of code, plus multiple preparation steps are required to get the result like “2+2=?”
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2455
Location: Hampshire, UK

PostPosted: Wed Sep 23, 2020 4:43 am
Reply with quote

Topic locked. A suitable solution has been posted in the Beginner's Forum.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   This topic is locked: you cannot edit posts or make replies. View Bookmarks
All times are GMT + 6 Hours
Forum Index -> SYNCSORT

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 7
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Remote Unload of CLOB Columns DB2 6
No new posts Increase the number of columns in the... IBM Tools 3
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
Search our Forums:

Back to Top