Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Syncsort FINDREP error on parsing CSV file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
purusothaman

New User


Joined: 17 Feb 2007
Posts: 39
Location: Chennai

PostPosted: Tue Sep 21, 2010 5:25 pm    Post subject: Syncsort FINDREP error on parsing CSV file
Reply with quote

I'm trying to parse a CSV file and convert in to a fixed length data fields. I'm able to achieve that successfully. When the data has a "," as in "$2,814", I am using PAIR=QUOTE to have that retained as part of the data.

But I do not need the quotation marks ("") in the output. I did a search on this in the forums here. I tried to use
Code:
IFTHEN=(WHEN=INIT,FINDREP=(IN=C'"',OUT=C'')),
to replace that quotes. But I am getting an error.

The details has been provided below.

Input File :
Code:
AmeriGas Partners L.P.,030975106,053302880,A18,MS CO C F, -   ,$99 ,132655998
EV Energy Partners L.P.,26926V107,558749459,A18,MS CO C F, -   ,"$2,814 ",132655998


Sort card that I used :
Code:

SORT FIELDS=(40,9,CH,A,49,11,CH,A)
  INREC IFTHEN=(WHEN=INIT,
        PARSE=(MEMNAME=(FIXLEN=35,ENDBEFR=COMMA),
                ACTVID=(FIXLEN=9,ENDBEFR=COMMA),
                   TID=(FIXLEN=9,ENDBEFR=COMMA),
                   BID=(FIXLEN=3,ENDBEFR=COMMA),
                  CSDN=(FIXLEN=35,ENDBEFR=COMMA),
                 CNAME=(FIXLEN=35,ENDBEFR=COMMA),
                  UNIT=(FIXLEN=13,PAIR=QUOTE,ENDBEFR=COMMA),
                AMOUNT=(FIXLEN=13,PAIR=QUOTE,ENDBEFR=COMMA),
                  CUST=(FIXLEN=9,ENDBEFR=COMMA))),
        IFTHEN=(WHEN=INIT,FINDREP=(IN=C'"',OUT=C'')),
  BUILD=(1,4,MEMNAME,ACTVID,TID,BID,CSDN,
              CNAME,UNIT,AMOUNT,CUST)

  OUTREC BUILD=(5,35,
                40,9,
                49,3,C'-',52,2,C'-',54,4,
                58,3,
                61,35,
                96,35,
               131,13,
               144,13,
               157,9),CONVERT


Error message:
Code:
SORT FIELDS=(40,9,CH,A,49,11,CH,A)
INREC IFTHEN=(WHEN=INIT,PARSE=(%08=(FIXLEN=35,ENDBEFR=C','),%07=(FIXLEN=9,ENDBEF
R=C','),%09=(FIXLEN=9,ENDBEFR=C','),%10=(FIXLEN=3,ENDBEFR=C','),%11=(FIXLEN=35,E
NDBEFR=C','),%12=(FIXLEN=35,ENDBEFR=C','),%04=(FIXLEN=13,PAIR=QUOTE,ENDBEFR=C','
),%13=(FIXLEN=13,PAIR=QUOTE,ENDBEFR=C','),%14=(FIXLEN=9,ENDBEFR=C',')),IFTHEN=(W
                                                                      *
HEN=INIT,FINDREP=(IN=C'"',OUT=C'')),BUILD=(1,4,%08,%07,%09,%10,%11,%12,%04,%13,%
14)
OUTREC BUILD=(5,35,40,9,49,3,C'-',52,2,C'-',54,4,58,3,61,35,96,35,131,13,144,13,
157,9),CONVERT
PARMLIST :
OPTION RESINV=0,ARESINV=0,MSGDDN=DFSMSG,SORTIN=IPWCFILE,SORTOUT=OPWCFILE,SORTDD=
CTL2,COPY
WER428I  CALLER-PROVIDED IDENTIFIER IS "0002"
WER268A  INREC STATEMENT   : SYNTAX ERROR
WER211B  SYNCSMF  CALLED BY SYNCSORT; RC=0000
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE


I am using symbols in the sort card. Please find the same below.
Code:
SECNUM,%01
OFFICE,%02
ACCOUNT,%03
UNITS,%04
NAME,%05
ACTVID,%06
CSIP,%07
MEMNAME,%08
TID,%09
BID,%10
CSDN,%11
CNAME,%12
AMOUNT,%13
CUST,%14
COMMA,','
DELM,'~'



Kindly advise and correct me.
Back to top
View user's profile Send private message

sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Wed Sep 22, 2010 7:17 pm    Post subject:
Reply with quote

purusothaman,
I don't have Syncsort but few points to note below...

1) You are using symbols as UNITS but in the sort card you refer UNIT. Note 'S' is missing here. You are using UNIT in PARSE (first IFTHEN) as well as BUILD (second IFTHEN).

2) Try to use BUILD with PARSE and FINDREP with second IFTHEN WHEN INIT.

3) Are you sure CONVERT is allowed with OUTREC? Check your manual and make sure CONVERT is allowed with OUTREC if not change OUTREC to OUTFIL.

Try this totally untested and see if it works for you...
Code:
   SORT FIELDS=(40,9,CH,A,49,11,CH,A)                                   
     INREC IFTHEN=(WHEN=INIT,                                           
           PARSE=(MEMNAME=(FIXLEN=35,ENDBEFR=COMMA),                   
                   ACTVID=(FIXLEN=9,ENDBEFR=COMMA),                     
                      TID=(FIXLEN=9,ENDBEFR=COMMA),                     
                      BID=(FIXLEN=3,ENDBEFR=COMMA),                     
                     CSDN=(FIXLEN=35,ENDBEFR=COMMA),                   
                    CNAME=(FIXLEN=35,ENDBEFR=COMMA),                   
                    UNITS=(FIXLEN=13,PAIR=QUOTE,ENDBEFR=COMMA),         
                   AMOUNT=(FIXLEN=13,PAIR=QUOTE,ENDBEFR=COMMA),         
                     CUST=(FIXLEN=9,ENDBEFR=COMMA)),                   
                   BUILD=(1,4,MEMNAME,ACTVID,TID,BID,CSDN,             
                              CNAME,UNITS,AMOUNT,CUST)),               
           IFTHEN=(WHEN=INIT,                                           
                   FINDREP=(IN=C'"',OUT=C''))                           
     OUTFIL BUILD=(5,35,                                               
                   40,9,                                               
                   49,3,C'-',52,2,C'-',54,4,                           
                   58,3,                                               
                   61,35,                                               
                   96,35,                                               
                  131,13,                                               
                  144,13,                                               
                  157,9),CONVERT                                       

Thanks,
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2238
Location: @my desk

PostPosted: Fri Sep 24, 2010 2:00 pm    Post subject:
Reply with quote

Quote:
Are you sure CONVERT is allowed with OUTREC?
sqlcode1,

Syncsort supports OUTREC CONVERT format. The problem seems to be with the PARSE not followed by BUILD/OVERLAY in the first IFTHEN as you pointed out and the misspelled symbol.
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 578
Location: USA

PostPosted: Sat Sep 25, 2010 1:53 am    Post subject:
Reply with quote

Arun,
Thanks for the confirmation.
Seems like OP has lost interest in this!!!

Thanks,
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts IDC2902I Error tzeche ABENDS & Debugging 2 Tue Mar 28, 2017 11:39 am
No new posts Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us