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
 
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 Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts Skip file from delete pema_yozer All Other Mainframe Topics 3 Tue Aug 29, 2017 3:19 pm
No new posts editting the file by inserting zeros ... pramodrsingh DFSORT/ICETOOL 9 Mon Aug 21, 2017 5:58 pm
No new posts Match two files using multiple keys a... santoshks1987 SYNCSORT 11 Fri Aug 18, 2017 10:50 am

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