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

Append space at end and convert comma to Spaces


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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 Developer


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

PostPosted: Tue Jun 21, 2011 10:21 pm
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
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: 1702
Location: Australia

PostPosted: Wed Jun 22, 2011 7:34 am
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 Developer


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

PostPosted: Wed Jun 22, 2011 10:34 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts How to append a PS file into multiple... JCL & VSAM 3
No new posts Keep leading zero(s) after convert fl... SYNCSORT 7
No new posts Need help to append a date&tsp at... DFSORT/ICETOOL 9
Search our Forums:

Back to Top