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
 

 

Convert a field into single character

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

New User


Joined: 05 Dec 2008
Posts: 20
Location: mumbai

PostPosted: Tue Dec 01, 2009 4:21 pm    Post subject: Convert a field into single character
Reply with quote

Hi,

Is there any i can convert the below file as given

Input

AAAAA,Tom
BBBB,Bell
CCCC,Com

Ouput

AAAAA,T
BBBB,B
CCCC,D

However pls note that I am just converting the second field with some predefined values. Basically it can be an if/then structure.

Is this possible?

Thanks icon_smile.gif
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Dec 01, 2009 4:30 pm    Post subject:
Reply with quote

yes
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Tue Dec 01, 2009 4:33 pm    Post subject:
Reply with quote

Because the solution for sort related questions may vary from product to product, please ensure that you state clearly which sort product you are using.

If you are not sure, then by running a simple sort step shown below, you will be able to find out for yourself.

If the messages start with ICE then your product is DFSORT. Please also post the output of the complete line which has a message code ICE201I, as this will enable our DFSORT experts to determine which release of DFSORT that you have installed. This may also affect the solution offered.

If the messages start with WER or SYT then the product is SYNCSORT and should be posted in the JCL forum. Please also post the information telling which version of SYNCSORT is installed, as this may also affect the solution offered.

Thank you for taking your time to ensure that the valuable time of others is not wasted by offering inappropriate solutions which are not relevant due to the sort product being used and/or the release that is installed in you site.

Code:
//SORTSTEP EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTIN   DD *
ABC
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  SORT     FIELDS=COPY


You also need to provide more detail than you already have.

What is the DSORG, RECFM & LRECL of the input and output files.

This is a link to the DFSORT smart tricks documentation which has examples of doing a great many things using DFSORT and ICETOOL. I do not know if the solution you are searching is contained in here, but this is a highly useful piece of documentation which may be invaluable in the future for other requirements.
Please click HERE to access it.
Back to top
View user's profile Send private message
essence21

New User


Joined: 05 Dec 2008
Posts: 20
Location: mumbai

PostPosted: Tue Dec 01, 2009 4:46 pm    Post subject:
Reply with quote

Hi Expat,

All the messages start with ICE. So DFSORT is used. Here are the mesages you asked for.

ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R10

ICE201I F RECORD TYPE IS F - DATA STARTS IN POSITION 1

RECFM will be FB and since this is just in design we could take sample LRECL of Input as 10 and that of output is also 10
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Dec 01, 2009 4:55 pm    Post subject:
Reply with quote

Quote:
However pls note that I am just converting the second field with some predefined values.


Can you please expain the rules for this(predefine values)
Back to top
View user's profile Send private message
essence21

New User


Joined: 05 Dec 2008
Posts: 20
Location: mumbai

PostPosted: Tue Dec 01, 2009 5:03 pm    Post subject:
Reply with quote

hey Sambhaji,

The values are not fixed yet but for now lets take 4 values and their corresponding 1 characters as follows;

TOMMY -> T
RICHARD -> R
TOMAS -> M
ROLAND -> N
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Dec 01, 2009 5:41 pm    Post subject:
Reply with quote

if these names are not going to be there in the record anywhere else then below code will work for you.
Or else we have to use parse first. Let us know if this suffice your requirement.
NOREP will not be replaced as we haven't mentioned it in FINDREP
Code:

//S1    EXEC  PGM=SORT                                 
//SORTIN DD *                                           
AAAAA,TOMMY                                             
BBBB,ROLAND                                             
CCCC,NOREP                                             
//SORTOUT DD SYSOUT=*                                   
//SYSOUT    DD  SYSOUT=*                               
//SYSPRINT DD SYSOUT=*                                 
//SYSIN    DD  *                                       
  OPTION COPY                                           
  OUTREC FINDREP=(INOUT=(C'TOMMY',C'T',C'RICHARD',C'R',
                         C'TOMAS',C'M',C'ROLAND',C'N'))
/*                                                     
Back to top
View user's profile Send private message
essence21

New User


Joined: 05 Dec 2008
Posts: 20
Location: mumbai

PostPosted: Tue Dec 01, 2009 5:52 pm    Post subject:
Reply with quote

Absolutely brilliant Sambhaji,

Works great !! icon_biggrin.gif

But could you also show me the parse method..

It would be great if there was an alternative.
Back to top
View user's profile Send private message
essence21

New User


Joined: 05 Dec 2008
Posts: 20
Location: mumbai

PostPosted: Tue Dec 01, 2009 6:09 pm    Post subject:
Reply with quote

Sambhaji,

Small problem i just noticed

for eg if I have similar strings like TOM and TOMMY and converting them by your method

EG., TOM with T and TOMMY with X gettin incorrect output

TOM gets converted to T perfectly but for TOMMY i get output as TMY.

I feel that the first replace command does (TOM)MY into (T)MY so the later replacement does not work...

Any suggestions?
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Dec 01, 2009 6:26 pm    Post subject:
Reply with quote

Use C'TOMMY',C'X' first and then C'TOM',C'T' in FINDREP
Similarly C'TOMAS',C'M', is also before C'TOM',C'T'
Like
Code:

//SYSIN    DD  *                                         
  OPTION COPY                                           
  OUTREC FINDREP=(INOUT=(C'TOMMY',C'X',C'RICHARD',C'R', 
          C'TOMAS',C'M',C'TOM',C'T',C'ROLAND',C'N'))     
/*                                                       
Back to top
View user's profile Send private message
essence21

New User


Joined: 05 Dec 2008
Posts: 20
Location: mumbai

PostPosted: Thu Dec 03, 2009 9:11 am    Post subject:
Reply with quote

Thanks a lot... It works fine this way... icon_smile.gif
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Thu Dec 03, 2009 10:27 am    Post subject:
Reply with quote

You are welcome.. icon_smile.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 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 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


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