Appending Elements to a Stem Variable
Select messages from
# through # FAQ
[/[Print]\]

MVSFORUMS.com -> TSO and ISPF

#1: Appending Elements to a Stem Variable Author: PhantomLocation: The Blue Planet PostPosted: Mon Jan 20, 2003 12:26 am
    —
I have 2 Stem variables "A." & "B.". I need to append the elements of Stem Variable "B." to A. Can this be done without having a loop.

Thanks & Regards,
Navin. J

#2:  Author: miboy PostPosted: Mon Jan 20, 2003 2:25 pm
    —
I don't think u can

#3:  Author: MikeLocation: Sydney, Australia PostPosted: Sun Jan 26, 2003 6:33 pm
    —
I would look at creating a third stem, populating this at the stem time that A. and B. are populated. You could also consider using the two stems concurrently rather than having a third. Perhaps we could assist better if you further explained the problem.

#4:  Author: PhantomLocation: The Blue Planet PostPosted: Sun Jan 26, 2003 11:24 pm
    —
The problem is simple. I wrote a REXX program that would expand all the copybooks found in the cobol program and store the expanded program into some PDS as specified by the user. This is an ISREDIT macro. So, I would use the CURSOR pointing func. to move line by line in the source code and copy the line into a stem variable. Once I find, any declaration of copybook, I will open the file using Alloc and capture the contents into a stem variable (B.) using DISKR utility. I need to append this stem to the main stem variable which contains the source code statements, and finally I would use the DISKW func. to write the expanded Stem variable (A.) to the file specified by the user. It's working fine, but I had to copy the contents of the B. stem into A. using 'DO I = 1 TO B.0' loop. I thought if there is any other way to move the entire contents of the Stem B. to A. it would be easy (Probably Efficient). Just curious to know if there is some way. Embarassed

Thanks,

#5:  Author: vikramdr PostPosted: Sun Feb 16, 2003 1:18 am
    —
Hi....

You can do that using commands....

/* put the contents of the stems to be appended to a stacks.... */
"pipe stem a. |stack fifo"
"pipe stem b. |stack fifo"

/*now give the stem name where u need to have the appended stems */
"pipe stack | stem a."

Smile

#6:  Author: coolmanLocation: US PostPosted: Mon Feb 17, 2003 3:04 am
    —
Vikram,
"PIPE" is not working for me.... Well this is all I tried...
IN1.1 = '0001'
IN1.2 = '0003'
"PIPE STEM IN1."

It says "Command not found " Rolling Eyes


Cheers,
Coolman.
________
buy iolite vaporizer


Last edited by coolman on Sat Feb 05, 2011 1:18 am; edited 1 time in total

#7:  Author: DibakarLocation: USA PostPosted: Mon Feb 17, 2003 6:27 am
    —
Here's my code that doesn't use stack

Code:

/* REXX for expanding cobol program
  This will create/replace member with same name as the current one
  in the user supplied dsn or default one. Exaples to invoke -
  1 xpand complete.dataset.name
  2 xpand
*/

address ISREDIT
"MACRO (dsn)"
"(userstat) = USER_STATE"
"(member)   = MEMBER"
if   length(dsn) = 0 then
     dsn = 'tso.pies.macros'
dsn = dsn||'('member||')'
"REC ON"
"CAPS OFF"

/* find first copy code and start expanding */
"FIND ' COPY ' 7 12 FIRST"
do while rc = 0
     "(currline) = LINE .ZCSR"
     copybook = word(substr(currline,13,60),1)
     copybook_len = length(copybook)
     if   substr(copybook,copybook_len,1) = '.' then
          copybook = substr(copybook,1,(copybook_len-1))
     "COPY "copybook" AFTER .ZCSR"

     /* find next copy code */
     "FIND ' COPY ' 7 12 NEXT"
end

"CREATE '"dsn"' .ZFIRST .ZLAST"
if   rc > 0 then do
     "REPLACE '"dsn"' .ZFIRST .ZLAST"
     if   rc > 0 then say 'Problem in saving to '''dsn''''
end

/* "UNDO" this is not working so you will have to undo manually */
"RESET FIND"
"USER_STATE =(userstat)"
exit

#8:  Author: PhantomLocation: The Blue Planet PostPosted: Mon Feb 17, 2003 10:33 pm
    —
Dibakar,

I have a problem using your code. The problem is that, your code will woek only if the Copybook is available in the same dataset where the actual program is available. What I want is that, when analysing some code, I want to expand the code. In this case the copybook will have to searched in all the 4 regions in Endevor and open it and insert the code into the program. So the "COPY" command does not work in this case. What I had done is that, search the copybook in the endevor libraries and stop on the first hit, and open it using alloc command and store the contents into a stem variable and then do a loop to append the contents of the stem variable into the program stem variable.

Anyway, thanks a lot for your suggesstion.
Phantom,

#9:  Author: coolmanLocation: US PostPosted: Mon Feb 17, 2003 10:56 pm
    —
Folks,
Were anybody able to use "PIPE", If so let me know ???

Cheers,
Coolman
________
discuss vaporizers


Last edited by coolman on Sat Feb 05, 2011 1:18 am; edited 1 time in total

#10:  Author: DibakarLocation: USA PostPosted: Tue Feb 18, 2003 1:19 am
    —
Phantom,

You copuld COPY from a different DSN too, syntax will be similar to the CREATE -
Code:

"COPY '"dsn.1"("copybook")' AFTER .ZCSR"
If rc > 0 then "COPY '"dsn.2"("copybook")' AFTER .ZCSR"
If rc > 0 then "COPY '"dsn.3"("copybook")' AFTER .ZCSR"
If rc > 0 then "COPY '"dsn.4"("copybook")' AFTER .ZCSR"
If rc > 0 then nop /* not found */

OR

Do i = 1 to 4
     "COPY '"dsn.i"("copybook")' AFTER .ZCSR"
     If rc = 0 then leave
     Else nop
End



To my problem,
Could anyone tell me the edit macro syntax/procedure for UNDO. I am getting following error when I code "UNDO"
Code:

,********************************************
,*,                                         
,*,Command in error . :,%UND                 
,*,                                         
,*,Command not found       ,                 
,*,"UNDO" is not an edit command or macro.   
,*,                                         
,*,  Error message ID . :,ISRE453 ,         
,*,                                         
,*,  Last return code . :,20      ,         
,*,                                         
,*,  Macro executing  . :,UNDO    ,         
,*,                                         
,*,Press,ENTER,key to terminate the macro.   
,********************************************

Thanks,
Diba

#11:  Author: warp5Location: Germany PostPosted: Tue Feb 18, 2003 1:52 am
    —
Undo is not an exec. Do not enter a % in front of it. Make sure you have recovery on, otherwise undo will not work for you.

#12:  Author: semigeezerLocation: Atlantis PostPosted: Tue Feb 18, 2003 2:25 am
    —
UNDO does not require recovery on. the SETUNDO (or SETU) command will let you use it out of storage. UNDO is not a command which is available in a macro (as the message is telling you). A quick look in the manual would have helped here.

#13:  Author: PhantomLocation: The Blue Planet PostPosted: Tue Feb 18, 2003 3:25 am
    —
Dibakar,

The copy command is working fine, when I tried to copy Members from other Datasets. Thanks a lot. Probably I did some mistake in my original code when It gave an error.

Thank you

#14:  Author: PremkumarLocation: Chennai, India PostPosted: Tue Feb 18, 2003 5:39 am
    —
SETUNDO may be turned of in some installations, like ours.

#15:  Author: DibakarLocation: USA PostPosted: Tue Feb 18, 2003 6:16 am
    —
Yes it is turned off.

Thanks,
Diba



MVSFORUMS.com -> TSO and ISPF


output generated using printer-friendly topic mod. All times are GMT - 5 Hours

Page 1 of 1

Powered by phpBB © 2001, 2005 phpBB Group