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
 

 

TSO change colume command needed

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> TSO/ISPF
View previous topic :: :: View next topic  
Author Message
kokwind

New User


Joined: 22 May 2008
Posts: 15
Location: Singapore

PostPosted: Tue Dec 24, 2013 1:26 pm    Post subject: TSO change colume command needed
Reply with quote

Hi all

I have a file as below
Code:

----+----1----+----2----+----3----+----4
DB-NAME TS-NAME DD NNNN                 
GCD FNGCD  GC 0001                     
GCD FNGCDRAD GC 0002                   
GCD FNGCDRCE GC 0003                   
GCD FNGCDROS GC 0004                   



I have to change all the dataset of the file as below
is there any tso command or any other way to do it?
Code:

----+----1----+----2----+----3----+----4-
DB-NAME  TS-NAME   DD        NNNN       
GCD      FNGCD     GC        0001       
GCD      FNGCDRAD  GC        0002       
GCD      FNGCDRCE  GC        0003       
GCD      FNGCDROS  GC        0004       


Thanks n Regards
Back to top
View user's profile Send private message

prino

Active Member


Joined: 07 Feb 2009
Posts: 985
Location: Oostende, Belgium

PostPosted: Tue Dec 24, 2013 1:31 pm    Post subject:
Reply with quote

What did you try? Which manuals couldn't you find?
Back to top
View user's profile Send private message
kokwind

New User


Joined: 22 May 2008
Posts: 15
Location: Singapore

PostPosted: Tue Dec 24, 2013 1:57 pm    Post subject:
Reply with quote

I try to use change command,but it can not do it.
Code:

C 'text1' 'text2' Changes next occurrence of text string
C 'text1' 'text2' all Changes all occurrences of text string
C 'text1' 'text2' all nn Changes all occurrences of text string in column nn
C 'text1' 'text2' all X Changes all occurrences of text string in excluded lines
C 'text1' 'text2' all NX Changes all occurrences of text string in Non excluded lines
C 'text1' 'text2' first Changes first occurrences of text string
C 'text1' 'text2' prev Changes previous occurrences of text string
C 'text1' 'text2' last Changes last occurrences of text string
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Tue Dec 24, 2013 2:07 pm    Post subject: Reply to: TSO change colume command needed
Reply with quote

You might try with a combination of the
BOUNDS command to isolate the columns to process
and the shift >/>> line command to do it
Back to top
View user's profile Send private message
kokwind

New User


Joined: 22 May 2008
Posts: 15
Location: Singapore

PostPosted: Tue Dec 24, 2013 3:01 pm    Post subject:
Reply with quote

i have 4000 members in a pds D/S
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Tue Dec 24, 2013 3:21 pm    Post subject: Reply to: TSO change colume command needed
Reply with quote

here is a snippet to parse and realign
Code:

#!/usr/bin/rexx

line.1 = "DB-NAME TS-NAME DD NNNN"
line.2 = "GCD FNGCD  GC 0001"
line.3 = "GCD FNGCDRAD GC 0002"

line.0 = 3

size   = 8

do  l = 1 to line.0
    newl.l = ""
    tail   = line.l
    do while ( tail \= "" )
        parse var tail tokn tail
        newl.l = newl.l || left(tokn, size)
    end
end

do  l = 1 to line.0
    say l line.l
    say l newl.l
end


and here is a snippet to apply an edit macro to all the member of a pds

http://www.ibmmainframes.com/viewtopic.php?t=25947&highlight=
Back to top
View user's profile Send private message
sureshpathi10

Active User


Joined: 03 May 2010
Posts: 154
Location: Kuala Lumpur

PostPosted: Tue Dec 24, 2013 7:18 pm    Post subject:
Reply with quote

I assumed the length of the columns like these

1st - 9
2nd - 10
3rd - 10
4th - 4

So, here is the enrico's modified code.
Code:

/*rexx*/                                                               
line.1 = "DB-NAME TS-NAME DD NNNN"                                     
line.2 = "GCD FNGCD  GC 0001"                                           
line.3 = "GCD FNGCDRAD GC 0002"                                         
line.0 = 3                                                             
size   = 8                                                             
do  l = 1 to line.0                                                     
  newl.l = ""                                                           
  word1 = subword(line.l,1,1)                                           
  newl.l = strip(word1) || copies(' ',9-length(strip(word1)))           
  word1 = subword(line.l,2,1)                                           
  newl.l = newl.l || strip(word1) || copies(' ',10-length(strip(word1)))
  word1 = subword(line.l,3,1)                                           
  newl.l = newl.l || strip(word1) || copies(' ',10-length(strip(word1)))
  word1 = subword(line.l,4,1)                                           
  newl.l = newl.l || strip(word1) || copies(' ',4-length(strip(word1)))
end                                                                     
do  l = 1 to line.0
    say l newl.l   
end               
exit               


Output:
Code:

1 DB-NAME  TS-NAME   DD        NNNN
2 GCD      FNGCD     GC        0001
3 GCD      FNGCDRAD  GC        0002
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Tue Dec 24, 2013 7:28 pm    Post subject: Reply to: TSO change colume command needed
Reply with quote

when You modify somebody else code the objective is to make it better, not worse icon_evil.gif

what is wrong with my code ? it is open and does not depend on the number of fields/words

and ... why write Your own version of the left builtin function ???

if You want to stick to a FIXED and IMMUTABLE number of words You can simply use

Code:
parse var line.l word1 word2 word3 word4 .


do not forget the final dot ( read the PARSE documentation to understand why )
Back to top
View user's profile Send private message
kokwind

New User


Joined: 22 May 2008
Posts: 15
Location: Singapore

PostPosted: Fri Dec 27, 2013 9:06 am    Post subject:
Reply with quote

Enrico and sureshpathi10
Thanks a lot for your valuabe inputs.
Your script gave me a better insight of how things work.
Code:

 /*REXX*/                                                                   
 PDS_NAME = 'MY PDS LIB'                                           
 SIZE   = 8                                                                 
 CALL OUTTRAP "TRAP."                                                       
 "LISTDS '"||PDS_NAME||"' MEMBERS"                                           
 IF RC <> 0 THEN DO                                                         
    SAY "ERROR: DATA SET DOES NOT EXIST"                                     
   EXIT 12                                                                   
 END                                                                         
 CALL OUTTRAP "OFF"                                                         
 DO I = 1 TO TRAP.0                                                         
 IF TRAP.I = "--MEMBERS--" THEN LEAVE                                       
    END                                                                     
 I = I + 1                                                                   
 DO J = I TO TRAP.0                                                         
    PARSE VALUE TRAP.J WITH MEM                                             
    MEM = STRIP(MEM)                                                         
    "ALLOC F(XXIN) DS('"PDS_NAME"("MEM")') SHR REUSE"                       
    "EXECIO * DISKR XXIN (FINIS STEM LINE."                                 
    "FREE F(XXIN)"                                                           
    HIT = 0                                                                 
    DO  L = 1 TO LINE.0                                                     
      NEWL.L = ""                                                           
      WORD1 = SUBWORD(LINE.L,1,1)                                           
      NEWL.L = STRIP(WORD1) || COPIES(' ',9-LENGTH(STRIP(WORD1)))           
      WORD1 = SUBWORD(LINE.L,2,1)                                           
      NEWL.L = NEWL.L || STRIP(WORD1) || COPIES(' ',10-LENGTH(STRIP(WORD1)))
      WORD1 = SUBWORD(LINE.L,3,1)                                           
      NEWL.L = NEWL.L || STRIP(WORD1) || COPIES(' ',10-LENGTH(STRIP(WORD1)))
      WORD1 = SUBWORD(LINE.L,4,1)                                           
      NEWL.L = NEWL.L || STRIP(WORD1) || COPIES(' ',4-LENGTH(STRIP(WORD1))) 
    END                                                                     
    "ALLOC F(XXIN) DS('"PDS_NAME"("MEM")') SHR REUSE"                       
    "EXECIO * DISKW XXIN (FINIS STEM NEWL."                                 
    "FREE F(XXIN)"                                                           
 END                                                                         
EXIT 
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 -> TSO/ISPF All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 6 Fri Nov 18, 2016 1:48 pm
No new posts SDSF Command Avtrix CLIST & REXX 4 Fri Sep 30, 2016 11:13 am
No new posts How to find a CICS resource used in C... Arunkumar Chandrasekaran CICS 8 Thu Sep 29, 2016 1:45 pm
No new posts COMPARE command sivatechdrive TSO/ISPF 7 Fri Sep 16, 2016 4:31 pm
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm


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