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
 

 

Append space at end and convert comma to Spaces

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

New User


Joined: 05 Dec 2006
Posts: 89
Location: chennai

PostPosted: Tue Jun 21, 2011 9:46 pm    Post subject: Append space at end and convert comma to Spaces
Reply with quote

Team,
I have following requirement and need to do thru any of utilities.
Input file - Having LRECL 80 having employee number.

But input file record will have variable employee number (some record will have 2 employee num some of them have 3 etc separated by comma)

Ex
Input file having 3 record

123456,23456,45678,,,,,,,,,,,,,,,,,
456789,12345,,,,,,,,,,,,,,,,,,,,,,,,,,,
345677,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,

Output file should be like below

123456,23456,45678
456789,12345
345677


ie) i need to remove lall the comma ',' into spaces only at the end of each record.

Any utilities like sort ,fileaid should be fine.

Thanks
Jagadesh
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: Tue Jun 21, 2011 10:21 pm    Post subject:
Reply with quote

Assuming your input file has RECFM=FB and your account numbers have a maximum of 6 digits, you can use a DFSORT job like the following to do what you asked for:

Code:

//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
123456,23456,45678,,,,,,,,,,,,,,,,,
456789,12345,,,,,,,,,,,,,,,,,,,,,,,,,,,
345677,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
  INREC IFOUTLEN=80,
   IFTHEN=(WHEN=INIT,
     PARSE=(%01=(ENDBEFR=C',',FIXLEN=7),
               %02=(ENDBEFR=C',',FIXLEN=7),
               %03=(ENDBEFR=C',',FIXLEN=7)),
     BUILD=(%01,%02,%03)),
   IFTHEN=(WHEN=INIT,BUILD=(1,21,SQZ=(SHIFT=LEFT,MID=C',')))
/*
Back to top
View user's profile Send private message
itjagadesh

New User


Joined: 05 Dec 2006
Posts: 89
Location: chennai

PostPosted: Wed Jun 22, 2011 5:44 am    Post subject: Reply to: Append space at end and convert comma to Spaces
Reply with quote

Thanks Much Frank .
Everything looks good except below one.

Comma (') missing in between employee number .

Below is the output coming now

1234562345645678
45678912345
345677


we are expecting in below format (ie need to remove comma only at end of all the records)

123456,23456,45678
456789,12345
345677

Please help me .

Thanks
Jagadesh
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Wed Jun 22, 2011 7:34 am    Post subject:
Reply with quote

Hi,

are you sure you have used exactly what Frank posted, I tried it and it works fine for me.

I'm also sure Frank would have tested it before posting his solution.


Gerry
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 Jun 22, 2011 10:34 pm    Post subject:
Reply with quote

Jagadesh,

Yes, I tested my solution and it works as expected, so you must have changed something or have something different from what you said.

Quote:
Comma (') missing in between employee number .


That looks like an apostrophe, not a comma. Do you actually have an apostrophe as the delimiter? That would certainly make a difference.

At any rate, I thought of a better solution, so try this one:

Code:
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
123456,23456,45678,,,,,,,,,,,,,,,,,
456789,12345,,,,,,,,,,,,,,,,,,,,,,,,,,,
345677,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
  OPTION COPY
  INREC BUILD=(1,80,SQZ=(SHIFT=LEFT,MID=C',',PREBLANK=C','))
/*


SORTOUT has:

Code:

123456,23456,45678
456789,12345       
345677             


If you actually have an apostrophe as the delimiter, use PREBLANK=C'''' instead of PREBLANK=C','.

If you still can't get it to work for you, show your complete JES log so I can figure out what's different for you.
Back to top
View user's profile Send private message
itjagadesh

New User


Joined: 05 Dec 2006
Posts: 89
Location: chennai

PostPosted: Thu Jun 23, 2011 3:41 am    Post subject: Reply to: Append space at end and convert comma to Spaces
Reply with quote

Frank ,

Sorry for my late response.

First solution itself working fine for me. I gave the input account number in wrong format thats why not working. I corrected my input records and ran with first solution (parse ) and working fine.

Thanks much for your quick help.

Regards
Jagadesh
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 How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts Convert +9999999999999.99 to S9(12)V9(3) vnktrrd DFSORT/ICETOOL 8 Thu Nov 17, 2016 8:15 pm
This topic is locked: you cannot edit posts or make replies. Db2 SQL query to convert rows into co... subratarec DB2 5 Thu Nov 17, 2016 4:51 pm
No new posts convert PD to ZD ram_vizag DFSORT/ICETOOL 5 Sat Nov 05, 2016 3:06 am
No new posts To trim spaces in a pipe delimited da... Nish84 COBOL Programming 16 Mon Oct 10, 2016 1:54 pm


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