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
 

 

CSV semicolon covert to CSV comma file.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
Huan-Nguyen

New User


Joined: 17 Jan 2006
Posts: 17

PostPosted: Wed Oct 24, 2007 3:43 am    Post subject: CSV semicolon covert to CSV comma file.
Reply with quote

Hi,

Are there anyone who can help me using DFsort, Iceman or Icetool to convert CSV Semicolon file below to the real CSV file, any data in double quote no change, only change French amount to American amount (Ex : 18,00 change to 18.00), delimited semicolon change to comma.

Input Data (VB file, record length around 1000)

"Header";"TESTFILE";"SW";"MR. SMITH, JOHN";5.00;3000;"EBR CSV Semicolon";18.00;200,00;"XXXXXXXX"
"Header";"TESTFILE";"SW";"SMITH, JOHN";15,00;17,00;"VVV CSV Semicolon";"YYYYY"
"Header";"TESTFILE";"SW";"SMITH. JOHN";15,00;12.00
"Header";"TESTFILE";"SW";"MR.SMITH;JOHN;JS.";15.00;0,50;"YYY CSV Semicolon"

Expected Output Data (VB file, record length the same as input)

"Header","TESTFILE","SW","MR. SMITH, JOHN",5.00,3000,"EBR CSV Semicolon";18.00,200.00,"XXXXXXXX"
"Header","TESTFILE","SW","SMITH, JOHN",15.00,17.00,"VVV CSV Semicolon"
"Header","TESTFILE","SW","SMITH. JOHN",15.00,12.00
"Header","TESTFILE","SW","MR.SMITH;JOHN;JS.",15.00,0.50,"YYY CSV Semicolon"

Very appreciated if you can help me on this.Thanks!
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Oct 24, 2007 4:44 am    Post subject:
Reply with quote

This is rather tricky because you appear to have some fields that can be either numeric or character (e.g. 18.00 and "YYYYY"). So I treated every field as having that possibility. If each field can actually only be numeric or only be character, but not both, I could give you a simpler solution.

At any rate, here's a DFSORT/ICETOOL job that will do what you asked for. I assumed each field could be a maximum of 20 bytes, but the job can be changed appropriately if that's not the case.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (VB/1000)
//SORTOUT DD LRECL=1000,DSN=...  output file (VB/1000)
// LRECL=1000
//SYSIN    DD    *
  OPTION COPY
  ALTSEQ CODE=(6B4B)
  INREC IFTHEN=(WHEN=INIT,
     PARSE=(%01=(ENDBEFR=C';',FIXLEN=20,PAIR=QUOTE),
            %02=(ENDBEFR=C';',FIXLEN=20,PAIR=QUOTE),
            %03=(ENDBEFR=C';',FIXLEN=20,PAIR=QUOTE),
            %04=(ENDBEFR=C';',FIXLEN=20,PAIR=QUOTE),
            %05=(ENDBEFR=C';',FIXLEN=20,PAIR=QUOTE),
            %06=(ENDBEFR=C';',FIXLEN=20,PAIR=QUOTE),
            %07=(ENDBEFR=C';',FIXLEN=20,PAIR=QUOTE),
            %08=(ENDBEFR=C';',FIXLEN=20,PAIR=QUOTE),
            %09=(ENDBEFR=C';',FIXLEN=20,PAIR=QUOTE),
            %10=(ENDBEFR=C';',FIXLEN=20,PAIR=QUOTE)),
     BUILD=(1,4,5:%01,25:%02,45:%03,65:%04,85:%05,
        105:%06,125:%07,145:%08,165:%09,185:%10)),
   IFTHEN=(WHEN=(5,1,CH,NE,C'"'),
     OVERLAY=(5:5,20,TRAN=ALTSEQ),HIT=NEXT),
   IFTHEN=(WHEN=(25,1,CH,NE,C'"'),
     OVERLAY=(25:25,20,TRAN=ALTSEQ),HIT=NEXT),
   IFTHEN=(WHEN=(45,1,CH,NE,C'"'),
     OVERLAY=(45:45,20,TRAN=ALTSEQ),HIT=NEXT),
   IFTHEN=(WHEN=(65,1,CH,NE,C'"'),
     OVERLAY=(65:65,20,TRAN=ALTSEQ),HIT=NEXT),
   IFTHEN=(WHEN=(85,1,CH,NE,C'"'),
     OVERLAY=(85:85,20,TRAN=ALTSEQ),HIT=NEXT),
   IFTHEN=(WHEN=(105,1,CH,NE,C'"'),
     OVERLAY=(105:105,20,TRAN=ALTSEQ),HIT=NEXT),
   IFTHEN=(WHEN=(125,1,CH,NE,C'"'),
     OVERLAY=(125:125,20,TRAN=ALTSEQ),HIT=NEXT),
   IFTHEN=(WHEN=(145,1,CH,NE,C'"'),
     OVERLAY=(145:145,20,TRAN=ALTSEQ),HIT=NEXT),
   IFTHEN=(WHEN=(165,1,CH,NE,C'"'),
     OVERLAY=(165:165,20,TRAN=ALTSEQ),HIT=NEXT),
   IFTHEN=(WHEN=(185,1,CH,NE,C'"'),
     OVERLAY=(185:185,20,TRAN=ALTSEQ))
  OUTREC BUILD=(1,4,5,200,SQZ=(SHIFT=LEFT,MID=C',',PAIR=QUOTE))
  OUTFIL VLTRIM=X'40'
/*
Back to top
View user's profile Send private message
Huan-Nguyen

New User


Joined: 17 Jan 2006
Posts: 17

PostPosted: Wed Oct 24, 2007 5:25 am    Post subject:
Reply with quote

It works perfectly, thank you very much for your great help. Many thanks...
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Wed Oct 24, 2007 8:48 pm    Post subject:
Reply with quote

Thanks for the feedback. Glad I could help. icon_biggrin.gif
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 -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


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