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

Syncsort FINDREP error on parsing CSV file


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 577
Location: USA

PostPosted: Wed Sep 22, 2010 7:17 pm
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: 2481
Location: @my desk

PostPosted: Fri Sep 24, 2010 2:00 pm
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: 577
Location: USA

PostPosted: Sat Sep 25, 2010 1:53 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
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
No new posts Error to read log with rexx CLIST & REXX 11
Search our Forums:

Back to Top