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
 

 

Can I replace string with the same string modified ?

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

New User


Joined: 30 Dec 2006
Posts: 4
Location: POLAND/Lodz

PostPosted: Sun Feb 04, 2007 4:15 pm    Post subject: Can I replace string with the same string modified ?
Reply with quote

Hello,
Is it possible to replace string with :
the same string having all leading zeros (0) removed ?
If string contains only zeros, last one should not be removed.
Eg. :
network ip address :
123.070.001.000 -> 123.70.1.0 .

I've asked about 1 string, because i suppose 123.070.001.000 can be splited into
123
070
001
000.

Thanks for Your replies.
oawo
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Sun Feb 04, 2007 6:33 pm    Post subject:
Reply with quote

Have you looked at some of the things that DFSort can do? I'm pretty sure that it can suppress the leading zeros in the 4 fields, and I know that it can shift left squeezing out the resulting blanks.
Have you checked the manual?
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: Sun Feb 04, 2007 9:45 pm    Post subject:
Reply with quote

oawo,

It's not clear what you want to do. Changing 123.070.001.000 to 123.70.1.0 is different than suppressing leading zeros in one number per record. DFSORT can do both, but in different ways.

Does the field you want to change start in position 1? If not, where does it start?

What is the RECFM and LRECL of your input file?

Please show a good example of your input records and what you expect for the output records.
Back to top
View user's profile Send private message
oawo

New User


Joined: 30 Dec 2006
Posts: 4
Location: POLAND/Lodz

PostPosted: Mon Feb 05, 2007 2:33 am    Post subject:
Reply with quote

Thanks for Your answers,
sorry for lack of precision - I fought that simplification of problem would help to focus on the solution.

The problem is :

I have a dataset with IP addresses of hosts.

RECFM = FB , LRECL = 300.

Each record contains :
string1;string2;string3

where :
string1 and string3 are not important
; - is delimiter
string2 is : W.X.Y.Z where W,X,Y,Z are numbers 0..255. (it is ip address).

In string2 numbers shorter than 3 digits length are completed with leading zeros to be 3 digits length.

For example : "25" contains 2 digits so in dataset is "025" .

I need to convert ip addresses completed with leading zeros to normal ip addresses - without completion.

Ip address starts after first occurrence of delimiter ";".

Example :

INPUT:

domain1;123.070.001.025;comment1
domain2.domain2.asdf;212.021.000.103;comment2

OUTPUT:

domain1;123.70.1.25;comment1
domain2.domain2.asdf;212.21.0.103;comment2
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Mon Feb 05, 2007 4:50 am    Post subject:
Reply with quote

oawo,

Have you looked at the DFSort manual and the Smart DFSORT Tricks manual? I spotted a function that "can extract the delimited fields into %nn parsed fixed fields" and once there I think DFSort can probably give you what you want.

Can you look at Smart DFSORT Tricks and see if your solution is there?

Bill
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: Mon Feb 05, 2007 6:05 am    Post subject:
Reply with quote

oawo,

Here's a DFSORT job that will do what you asked for. I assumed field1 has a maximum length of 30 bytes.

You'll need z/OS DFSORT V1R5 PTF UK90007 or DFSORT R14 PTF UK90006 (April, 2006) in order to use DFSORT's PARSE and SQZ functions. If you don't have the April, 2006 PTF, ask your System Programmer to install it (it's free). For complete details on all of the new DFSORT and ICETOOL functions available with the April, 2006 PTF, see:

www.ibm.com/servers/storage/support/software/sort/mvs/peug/

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/300)
//SORTOUT DD DSN=...  output file (FB/300)
//SYSIN    DD    *
   OPTION COPY
   INREC IFOUTLEN=300,
     IFTHEN=(WHEN=INIT,
       PARSE=(%01=(ENDAT=C';',FIXLEN=30),
              %02=(ENDBEFR=C'.',FIXLEN=3),
              %03=(ENDBEFR=C'.',FIXLEN=3),
              %04=(ENDBEFR=C'.',FIXLEN=3),
              %05=(ENDBEFR=C';',FIXLEN=3),
              %06=(FIXLEN=300)),
       BUILD=(%01,
              %02,UFF,EDIT=(IIT),C'.',
              %03,UFF,EDIT=(IIT),C'.',
              %04,UFF,EDIT=(IIT),C'.',
              %05,UFF,EDIT=(IIT),C';',
              %06)),
     IFTHEN=(WHEN=INIT,
       BUILD=(1,346,SQZ=(SHIFT=LEFT)))
/*
Back to top
View user's profile Send private message
oawo

New User


Joined: 30 Dec 2006
Posts: 4
Location: POLAND/Lodz

PostPosted: Mon Feb 05, 2007 1:26 pm    Post subject:
Reply with quote

Your answers are what what I've been looking for.
Frank's solution shows exactly how to handle this kind of problems.
I've checked William's link - it contains PARSE - also answer to my question.
Thanks for help !
oawo
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 Replace repeated JCL with looping REXX prino CLIST & REXX 3 Thu Oct 13, 2016 5:30 am
This topic is locked: you cannot edit posts or make replies. Checking wether a string starts from ... sundaram.naveen CLIST & REXX 9 Thu Oct 06, 2016 11:56 am
This topic is locked: you cannot edit posts or make replies. Sort card to replace text using cross... Susanta SYNCSORT 32 Tue Sep 13, 2016 4:17 pm
No new posts Replace function abdulrafi COBOL Programming 13 Mon Sep 12, 2016 10:12 am
No new posts Random Password (in string format) ge... ezhavendhan COBOL Programming 10 Mon Aug 29, 2016 3:18 pm


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