MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Replace a String based on multiple conditions

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
kseenu
Beginner


Joined: 08 Jun 2004
Posts: 11
Topics: 5

PostPosted: Mon Aug 07, 2006 8:00 am    Post subject: Replace a String based on multiple conditions Reply with quote

All,


My requirement is:

I have a file of recl 140 in FB format

I have to check the Columns 1 and 5 and if the columns has the value ':' and 'X' respectively and 20,21 column contains the value 'ST', then I have to replace the 20,21 with 'UR'

Both Input and output file should be same. I should have not a different file as an Output.

I have create a REXX exec and executed for the above requirment. But the client requires this to be performed thru JCL.

Can we perform this using DFSORT?

thanks
Seenu
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Mon Aug 07, 2006 9:03 am    Post subject: Reply with quote

kseenu,

Try this code.Hope it helps.
Code:

//STEP0100 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SYSPRINT DD SYSOUT=*                                                 
//SORTIN   DD DSN=SHEKAR.WORK.INPUT,DISP=SHR                           
//SORTOUT  DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(1,1),RLSE)               
//SYSIN    DD *                                                         
  SORT FIELDS=COPY                                                     
  OUTREC IFTHEN=(WHEN=(1,1,CH,EQ,C':',AND,                             
                       5,1,CH,EQ,C'X',AND,                             
                       20,2,CH,EQ,C'ST'),                               
         OVERLAY=(1,19,20:C'UR',22,58))                                 
/*                                                                     
//STEP0200 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SYSPRINT DD SYSOUT=*                                                 
//SORTIN   DD DSN=&T1,DISP=SHR                                         
//SORTOUT  DD DSN=SHEKAR.WORK.INPUT,DISP=SHR                           
//SYSIN    DD *                                                         
  SORT FIELDS=COPY                                                     
/*   
//                                                                 

_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Mon Aug 07, 2006 9:10 am    Post subject: Reply with quote

kseenu,

I have assumed the Input Dataset LRECL = 80 ,in your case as it is 140 change the statement:
Code:

OVERLAY=(1,19,20:C'UR',22,119))                                 

_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
kseenu
Beginner


Joined: 08 Jun 2004
Posts: 11
Topics: 5

PostPosted: Mon Aug 07, 2006 10:02 am    Post subject: Reply with quote

thanks sekhar..
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Mon Aug 07, 2006 11:22 am    Post subject: Reply with quote

kseenu,

you can even try this

Code:

//STEP0100 EXEC PGM=FILEAID,REGION=0M   
//SYSPRINT DD SYSOUT=*                 
//DD01     DD *                         
:R2RX              ST                   
AR2RX              ST                   
BR2RX              ST                   
CR2RX              ST                   
:R2RX              LM                   
//DD01O    DD SYSOUT=*                 
//SYSIN    DD *                         
$$DD01 COPYALL IF=(1,EQ,C':'),         
              AND=(5,EQ,C'X'),         
              AND=(20,EQ,C'ST'),       
              REPL=(20,C'UR')           
/*                                     


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Aug 07, 2006 11:45 am    Post subject: Reply with quote

Seenu,

shekar123's job is unnecessarily complicated. It only takes one pass to do this with DFSORT and you only need the field to be overlaid in OVERLAY (that's the point of OVERLAY). Here's the correct DFSORT job to do what you want to do:

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/140)
//SORTOUT DD DSN=...  output file (FB/140)
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(1,1,CH,EQ,C':',AND,
                      5,1,CH,EQ,C'X',AND,
                     20,2,CH,EQ,C'ST'),
        OVERLAY=(20:C'UR'))
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Mon Aug 07, 2006 12:14 pm    Post subject: Reply with quote

kseenu wrote:

Both Input and output file should be same. I should have not a different file as an Output.


Frank,

Shekhar's idea of 2 steps is for the above requirement(just in case to save the input file if something goes wrong.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Mon Aug 07, 2006 3:44 pm    Post subject: Reply with quote

Oh, I missed that. I would have used an ICETOOL step for that case. Still, the OVERLAY using all fields was unncessary. And your one pass FILEAID job kind of misled me too as it didn't have the input and output the same either. Laughing
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
kseenu
Beginner


Joined: 08 Jun 2004
Posts: 11
Topics: 5

PostPosted: Fri Aug 11, 2006 1:46 am    Post subject: Reply with quote

The DFSORT was working fine when I executed on the Test Region. I have included the Sortwk1-SortWK4 steps in the JCL.

But when we executed the same on the Production, the job abended with the 0061 error code. The following is the sysout from Prod
Code:

 IEA995I SYMPTOM DUMP OUTPUT  352                           
   USER COMPLETION CODE=0061                                 
  TIME=22.50.27  SEQ=07423  CPU=0000  ASID=0088             
  PSW AT TIME OF ERROR  078D1000   85C27280  ILC 2  INTC 0D 
    NO ACTIVE MODULE FOUND                                   
    NAME=UNKNOWN                                             
    DATA AT PSW  05C2727A - B2580BA0  0A0D9180  DAB247E0     
    AR/GR 0: 80BE82CA/00000001   1: 00000000/8000003D       
          2: 00000000/00008F30   3: 00000000/00020CD0       
          4: 00000000/05C2EEBA   5: 00000000/00020CD0       
          6: 00000000/00027AA0   7: 00000000/00988D70       
          8: 00000000/05C2BBC8   9: 00000000/05C2AE58       
          A: 00000000/85C27280   B: 00000000/85C27028       
          C: 00000000/05BCE928   D: 00000000/00007000       
          E: 00000000/00000080   F: 01000002/00000010       
  END OF SYMPTOM DUMP                                       

The file had around 600,000 records and when I used the same file on Test region, the sort is working fine. Cant able to figure out why it is abending in Prod region alone.

Can anybody throw some light on why it is abending?


Thanks
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Fri Aug 11, 2006 4:35 am    Post subject: Reply with quote

kseenu,

You need to post the sysout of the sort step instead of the job log. Also post the JCL you used.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Aug 11, 2006 10:39 am    Post subject: Reply with quote

The U0061 is associated with message ICE061A - an I/O error. The JES messages and DFSORT messages will tell you more about the reason for the I/O error. Most likely, you're using different volumes on the Test and Production system and the error is associated with a volume on the Production system. Here's a link to the information for the ICE061A message:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CM20/2.2.60?SHELF=&DT=20060721170811&CASE=
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group