Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
change string before sertan string

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

Active User


Joined: 20 May 2010
Posts: 111
Location: canada

PostPosted: Tue Aug 15, 2017 5:43 pm    Post subject: change string before sertan string
Reply with quote

Hi,

I have file (fb,80) where could be combination of AA or BB or CC or DD in any position ( only one combination per record) . Is it possible to change 3 position before combination to 111 if it is 000 there.

Input


Code:

00000000000000000AA111111111111111111       
22222222BB000000000000000000000             
             CC0000000000000000000000       
000000000000000000000000000DD111111111       


Output:

Code:

00000000000000111AA111111111111111111   
22222222BB000000000000000000000         
             CC0000000000000000000000   
000000000000000000000000111DD111111111 
Back to top
View user's profile Send private message

anatol

Active User


Joined: 20 May 2010
Posts: 111
Location: canada

PostPosted: Tue Aug 15, 2017 6:26 pm    Post subject: Reply to: change string before sertan string
Reply with quote

Sorry, I read my post and understood, that you will probably suggest me to use FINDREP function .... but real case more complicated, then I define it initially ...in general - I need to work /change 3 position before combination of AA,BB,CC,DD
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 408
Location: USA

PostPosted: Tue Aug 15, 2017 6:50 pm    Post subject: Reply to: change string before sertan string
Reply with quote

Can you tell us:

What is 'sertan'?? Do you mean to say 'certain' ??

What is your issue with FINDREP? Why can't you use that? What is real case which is supposed to be more complicated?

.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1922
Location: UK

PostPosted: Tue Aug 15, 2017 7:18 pm    Post subject:
Reply with quote

Are you saying that there must be 4 records present (1 x AA, 1 x BB, 1 x CC and 1 x DD) before you can change 000AA to 111AA in that group of four?
If so, will there only be four records in the group to be changed?
Back to top
View user's profile Send private message
anatol

Active User


Joined: 20 May 2010
Posts: 111
Location: canada

PostPosted: Tue Aug 15, 2017 7:49 pm    Post subject:
Reply with quote

sorry, it was typo with certain ...
I am saying that if combination of AA is in the record, then not other combinations as BB, CC etc in this record...

I cannot use FINDREP 000AA to 111AA because it is more complicated - it is not just change 000 to 111 ... it is in my request, but I need idea how to change 3 positions before combination .... it is not just 000 to 111 ...maybe better to explain .... I need to change 3 position before AA to 111 if this 3 positions NOT = 000 ... could be 123 or 321 or 1g1 ... so I cannot use FINDREP
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 408
Location: USA

PostPosted: Tue Aug 15, 2017 8:26 pm    Post subject: Reply to: change string before sertan string
Reply with quote

You'll need to use PARSE to break your record into possibly 4 parts,

something similar to (not tested so may not be exactly what you want):
Code:
 INREC PARSE=(%00=(ENDBEFR=C'AA',FIXLEN=80),
       %01=(SUBPOS=5,ENDBEFR=C'AA',FIXLEN=3),
       %02=(STARTAFT=C'AA',FIXLEN=80)),     
       BUILD=(%00,%01,C'AA',%02)             


And then you can user OVERLAY to whatever condition you want on '000' or 'Not 000'. similar to:
Code:
 OUTREC IFTHEN=(WHEN=(81,3,CH,NE,C'000',AND,84,2,CH,EQ,C'AA'),
                  OVERLAY=(81:C'111'))


I am in a rush but I hope this may give you some idea.

.
Back to top
View user's profile Send private message
anatol

Active User


Joined: 20 May 2010
Posts: 111
Location: canada

PostPosted: Tue Aug 15, 2017 9:08 pm    Post subject:
Reply with quote

Thank you, I will try
Back to top
View user's profile Send private message
magesh23586

Active User


Joined: 06 Jul 2009
Posts: 210
Location: Chennai

PostPosted: Tue Aug 15, 2017 9:57 pm    Post subject: Reply to: change string before sertan string
Reply with quote

Your condition is little confusing, any way below code may give you some insight.

Assuming LRECL=40

Code:

//SYSIN DD *                                                 
 OPTION COPY                                                 
 INREC  IFTHEN=(WHEN=INIT,                                   
                FINDREP=(INOUT=(C' ',C'~'))),               
                                                             
        IFTHEN=(WHEN=INIT,                                   
                PARSE=(%01=(ENDAT=C'AA',                     
                            ENDAT=C'BB',                     
                            ENDAT=C'CC',                     
                            ENDAT=C'DD',                     
                            FIXLEN=40),                       
                       %02=(FIXLEN=40)),                     
                BUILD=(%01,JFY=(SHIFT=RIGHT),%02)),         
                                                             
        IFTHEN=(WHEN=(39,2,SS,EQ,C'AA,BB,CC,DD',AND,         
                      36,3,CH,NE,C'000'),                   
                OVERLAY=(36:C'111'))                         
                                                             
 OUTREC IFTHEN=(WHEN=INIT,                                   
                BUILD=(1,80,SQZ=(SHIFT=LEFT))),
                                               
        IFTHEN=(WHEN=INIT,                     
                FINDREP=(INOUT=(C'~',C' '))), 
                IFOUTLEN=40                   
                                                                                                       


output :
Code:

00000000000000000AA111111111111111111     
22222111BB000000000000000000000           
          111CC0000000000000000000000     
000000000000000000000000000DD111111111     
Back to top
View user's profile Send private message
anatol

Active User


Joined: 20 May 2010
Posts: 111
Location: canada

PostPosted: Tue Aug 15, 2017 10:28 pm    Post subject:
Reply with quote

wow, looks great ... I 'll try to understand it line by line.... thank you , it's very nice idea
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 line 52: Name or string > 250 char... Ashishpanpaliya CLIST & REXX 5 Sat Oct 14, 2017 2:29 am
No new posts Partial color change of a field in CI... waseem0424 CICS 5 Fri Sep 29, 2017 7:56 pm
No new posts Search for a string in many PDS KARTHIGADEVI CLIST & REXX 5 Fri Sep 08, 2017 2:32 pm
No new posts How to change a string containing the... chong.zhou TSO/ISPF 6 Tue Aug 29, 2017 4:54 pm
No new posts String after '.' (period) is not copy... balaji81_k SYNCSORT 6 Wed Aug 23, 2017 9:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us