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
 

 

Move one Stem to another

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
knobi

New User


Joined: 16 Aug 2005
Posts: 46

PostPosted: Fri Jul 03, 2015 5:16 am    Post subject: Move one Stem to another
Reply with quote

hi.. It's been awhile since the last time with rexx and i'm getting some logic trouble to put one stem into another one. Basically i'm trying to group 4 lines from old stem into 1 line on the new one. Any help is welcome! Thanks !

old.1 = "A"
old.2 = "A"
old.3 = "A"
old.4 = "A"
old.5 = "A"
old.6 = "A"
old.7 = "A"
old.8 = "A"

desired result
new.1 = "A A A A"
new.2 = "A A A A"

Note, not sure if counts or not but the old. stem may have 200 lines and may not be multiple by 4... so last new var may have few than 4 A's.
Back to top
View user's profile Send private message

Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2029
Location: Silicon Valley

PostPosted: Fri Jul 03, 2015 5:27 am    Post subject: Reply to: Move one Stem to another
Reply with quote

Your example would be better if the OLD stem had different values so we could see where they came from and where you want them.


1. you want a loop to process all of the OLD stem
2. within the loop, you need assignment statements for the NEW stem
3. concatenate the OLD stem values to whatever is in NEW stem
4. increment the index for the NEW stem every four times.
Back to top
View user's profile Send private message
knobi

New User


Joined: 16 Aug 2005
Posts: 46

PostPosted: Fri Jul 03, 2015 5:51 am    Post subject:
Reply with quote

thanks.. but it didn't help... as i said it been awhile... pls don't feel obligated to post...




folks... any change to the code below is welcome...

Code:
full.1=" "                                   
 x=1                                           
 do i=1 to dat1.0                             
                                               
    if substr(dat1.i,28,1) = "X" then do       
       full.x = full.x || substr(dat1.i,29,10)
                                               
    end                                       
 end                                           
                                               
  say full.1                                   
                                               
exit 0


Code'd
Back to top
View user's profile Send private message
knobi

New User


Joined: 16 Aug 2005
Posts: 46

PostPosted: Fri Jul 03, 2015 6:37 am    Post subject:
Reply with quote

i think i got it.. thanks !!!
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1531
Location: Andromeda Galaxy

PostPosted: Fri Jul 03, 2015 8:03 pm    Post subject:
Reply with quote

What do you want to do if the file is having empty line?
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 -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 8 Wed Jan 25, 2017 8:24 pm
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 0 Wed Jan 25, 2017 8:23 pm
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 0 Wed Jan 25, 2017 8:21 pm
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm


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