View previous topic :: View next topic |
Author |
Message |
Phantom Data Mgmt Moderator
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Mon Jan 20, 2003 12:26 am Post subject: Appending Elements to a Stem Variable |
|
|
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 |
|
Back to top |
|
|
miboy Beginner
Joined: 10 Jan 2003 Posts: 13 Topics: 0
|
Posted: Mon Jan 20, 2003 2:25 pm Post subject: |
|
|
I don't think u can |
|
Back to top |
|
|
Mike Beginner
Joined: 03 Dec 2002 Posts: 114 Topics: 0 Location: Sydney, Australia
|
Posted: Sun Jan 26, 2003 6:33 pm Post subject: |
|
|
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. _________________ Regards,
Mike. |
|
Back to top |
|
|
Phantom Data Mgmt Moderator
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Sun Jan 26, 2003 11:24 pm Post subject: |
|
|
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.
Thanks, |
|
Back to top |
|
|
vikramdr Beginner
Joined: 15 Feb 2003 Posts: 15 Topics: 11
|
Posted: Sun Feb 16, 2003 1:18 am Post subject: |
|
|
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."
_________________ Vikram |
|
Back to top |
|
|
coolman Intermediate
Joined: 03 Jan 2003 Posts: 283 Topics: 27 Location: US
|
Posted: Mon Feb 17, 2003 3:04 am Post subject: |
|
|
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 "
Cheers,
Coolman.
________
buy iolite vaporizer
Last edited by coolman on Sat Feb 05, 2011 1:18 am; edited 1 time in total |
|
Back to top |
|
|
Dibakar Advanced
Joined: 02 Dec 2002 Posts: 699 Topics: 63 Location: USA
|
Posted: Mon Feb 17, 2003 6:27 am Post subject: |
|
|
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
|
|
|
Back to top |
|
|
Phantom Data Mgmt Moderator
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Mon Feb 17, 2003 10:33 pm Post subject: |
|
|
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, |
|
Back to top |
|
|
coolman Intermediate
Joined: 03 Jan 2003 Posts: 283 Topics: 27 Location: US
|
Posted: Mon Feb 17, 2003 10:56 pm Post subject: |
|
|
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 |
|
Back to top |
|
|
Dibakar Advanced
Joined: 02 Dec 2002 Posts: 699 Topics: 63 Location: USA
|
Posted: Tue Feb 18, 2003 1:19 am Post subject: |
|
|
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 |
|
Back to top |
|
|
warp5 Intermediate
Joined: 02 Dec 2002 Posts: 429 Topics: 18 Location: Germany
|
Posted: Tue Feb 18, 2003 1:52 am Post subject: |
|
|
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. |
|
Back to top |
|
|
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Tue Feb 18, 2003 2:25 am Post subject: |
|
|
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. |
|
Back to top |
|
|
Phantom Data Mgmt Moderator
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
|
Posted: Tue Feb 18, 2003 3:25 am Post subject: |
|
|
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 |
|
Back to top |
|
|
Premkumar Moderator
Joined: 28 Nov 2002 Posts: 77 Topics: 7 Location: Chennai, India
|
Posted: Tue Feb 18, 2003 5:39 am Post subject: |
|
|
SETUNDO may be turned of in some installations, like ours. |
|
Back to top |
|
|
Dibakar Advanced
Joined: 02 Dec 2002 Posts: 699 Topics: 63 Location: USA
|
Posted: Tue Feb 18, 2003 6:16 am Post subject: |
|
|
Yes it is turned off.
Thanks,
Diba |
|
Back to top |
|
|
|
|