SORT card needed for CSV to FB formatting

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
goldyroshan
Active Member
Posts: 67
Joined: Thu Apr 05, 2012 1:29 am
Location: WI, USA

SORT card needed for CSV to FB formatting

Post by goldyroshan » Tue Mar 24, 2015 4:07 am

Here is how my input file looks (CSV) -

Code: Select all

Account Number,GroupCycle,GroupName,CustomerNumber  
000031973,1,BENSONHURST FAMILY VISION,00668360      
000034970,1,BLANE CASEY BUILDING CONTRACTO,00792198 
000070739,1,"D & D COLLISION SERVICES, INC",00524910
Here is what I need in my o/p FB file -
1) I do not need the 1st row (the header) in my o/p.
2) The last column (customer number) values should be the 1st column in my o/p file,
3) The first column (Account number) should be the 2nd column in my o/p file.

The o/p file should look like this -

Code: Select all

0668360 	000031973
0792198 	000034970
0524910 	000070739

This is the sort card that I attempted, but I know there has to be something more to it -

Code: Select all

OPTION COPY                               
OUTREC PARSE=(%01=(ENDBEFR=C','FIXLEN=14),
              %02=(ENDBEFR=C','FIXLEN=10),
              %03=(ENDBEFR=C','FIXLEN=9), 
              %04=(ENDBEFR=C','FIXLEN=14))
       BUILD =(%04,%01)                   
Please help with the sort card.
Logically yours,
:-) GRS :-)

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Tue Mar 24, 2015 12:19 pm

Code: Select all

OPTION COPY                               
 INREC PARSE=(%01=(ENDBEFR=C','FIXLEN=14),
              %=(ENDBEFR=C','FIXLEN=10),
              %=(ENDBEFR=C','FIXLEN=9),
              %04=(ENDBEFR=C','FIXLEN=14)),
        BUILD =(%04,%01)  
You were missing a comma.

OUTREC does not have special magical powers, so use INREC (which doesn't either).

If you are PARSEing fields you don't need to use, you don't need to name them,

If there is some other problem, you need to tell us what it actually is, and paste the sysout from the step showing it.

goldyroshan
Active Member
Posts: 67
Joined: Thu Apr 05, 2012 1:29 am
Location: WI, USA

Post by goldyroshan » Tue Mar 24, 2015 8:24 pm

Here is my sort card -

Code: Select all

SORT FIELDS=COPY                          
INREC PARSE=(%01=(ENDBEFR=C',',FIXLEN=9), 
             %02=(ENDBEFR=C',',FIXLEN=1), 
             %03=(ENDBEFR=C',',FIXLEN=40),
             %04=(ENDBEFR=C',',FIXLEN=8)),
       BUILD =(1:%04,9:%01)               
Here is the error -

Code: Select all

SYSIN :                                      
 SORT FIELDS=COPY                            
 INREC PARSE=(%01=(ENDBEFR=C',',FIXLEN=9),   
              %02=(ENDBEFR=C',',FIXLEN=1),   
              %03=(ENDBEFR=C',',FIXLEN=40),  
              %04=(ENDBEFR=C',',FIXLEN=8)),  
                                          *  
        BUILD =(1:%04,9:%01)                 
WER161B  ALTERNATE PARM USED                 
WER268A  INREC STATEMENT   : SYNTAX ERROR    
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
Logically yours,
:-) GRS :-)

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Tue Mar 24, 2015 10:29 pm

Space between the BUILD and the =

goldyroshan
Active Member
Posts: 67
Joined: Thu Apr 05, 2012 1:29 am
Location: WI, USA

Post by goldyroshan » Tue Mar 24, 2015 10:42 pm

yup, that was the problem.
working fine now.
thanks much!
Logically yours,
:-) GRS :-)

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others