Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 2285
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 IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts Execute JCL step based on the content... sprikitik JCL & VSAM 2 Tue Oct 03, 2017 10:03 am
This topic is locked: you cannot edit posts or make replies. PS file data should be passed as symb... d_sarlie JCL & VSAM 15 Tue Oct 03, 2017 5:18 am
No new posts FTP Skip or ignore error and process ... AJAYREDDY All Other Mainframe Topics 3 Wed Sep 27, 2017 8:12 pm
No new posts Garbage on output file Hervey Martinez SYNCSORT 4 Wed Sep 27, 2017 12:50 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us