Hi,
I found my mods to CP1STLVL, but once again, my
laziness in documenting changes has struck back.
My mod says it affects the following subjects:
1. DON'T BOTHER SAVING R0.
2. USE PFX1 INSTEAD OF INTERNAL CONSTANT F'1'
3. USE HCPGETST TO ALLOCATE 4000 BYTES, INSTEAD OF
AN INTERNAL BUFFER OF 1600 BYTES.
4. ADD SPECIAL RETCODES
5. RETURN CODES MUST USE SAVER2, NOT SAVER15.
6. CHECK FOR 2ND LEVEL
CP1STL as I downloaded it ALWAYS returns a zero return code.
As part of my desire to use pipes or execs, I wanted it
to give me the RC it got from the first level system.
However, there are a few cases where the retcode is
generated by the second level system. These codes are
displayed by CP1STLVL as errors beginning with "???".
I made a few changes to these, based on a similar
package called CPFIRST. They are not described in my
source file, but seem to be:
30004 - no command found to pass to 1st level
30008 - not running in a second level VM
30012 - supplied CP command was longer than 240 characters
As can be seen here, all of the 'special' retcodes are in the
30,000 range to make them easy to identify.
I also wanted to differentiate between a
RC=1 on the first level system (CP command passed
does not exist), and on the second level system
(no such command as CP1STL). So I changed the
first level '1' to another 'special retcode':
30001 - no such first level CP command (that's 30K + 1st lvl retcode)
Another thing I never wrote down in my comments, was the change
which allowed PIPE to catch the CP output. That was really simple!
I deleted the "DESTINATION=TERMINAL" operand of the HCPCONSL
macro which displays the 1st level output. The "???" messages
still use that operand and are displayed on the terminal
directly (but you can still catch them by the 30K+ retcode).
The rest of the stuff I did is just cleanup and an increase
in the size of the diagnose buffer. BTW, in order to apply
a mod to the original CP1STLVL source, I had to add line
sequencing, I used SEQ8 1000 1000.
One last thing I changed - I call my new CP command by the
old name of "HOST" (see "installation exec at the end of
my appends below).
HTH,
Shimon
================ CP1STL AUXLCL =================
CP1STL AUXLCL M1; F 80 BLKS=1 COL=1 REC=1 OF 1 FILES=1
====>
POLHOST LCL LCLHOST * SOME CHANGES TO CP1STL LIKE CPFIRST
* * * END OF FILE * * *
=============== CP1STL POLHOST =================
./ I 00042000 § 42080 80 11/26/03 09:42:05
* >>> ORIGINALLY BY TIM GREER, AVAILABLE AT: 00042090
* HTTP://WWW.VM.IBM.COM/DOWNLOAD/PACKAGES/DESCRIPT.CGI?CP1STLVL 00042180
* ------------- CHANGES BY SHIMON 00042270
* 21/11/03 - 1. DON'T BOTHER SAVING R0. 00042360
* 2. USE PFX1 INSTEAD OF INTERNAL CONSTANT F'1' 00042450
* 3. USE HCPGETST TO ALLOCATE 4000 BYTES, INSTEAD OF 00042540
* AN INTERNAL BUFFER OF 1600 BYTES. 00042630
* 4. ADD SPECIAL RETCODES 00042720
* 5. RETURN CODES MUST USE SAVER2, NOT SAVER15. 00042810
* 6. CHECK FOR 2ND LEVEL
* ------------- 00042900
./ R 00061000 § 61290 290 11/26/03 09:42:05
TM PFXCPUID,CPUIDVM RUNNING IN A VIRTUAL MACHINE?
BNO NOTLVL2 NO, BETTER NOT USE DIAGNOSE
./ R 00079000 00081000 § 79390 390 11/26/03 09:42:05
LA R1,4000 RESPONSE BUFFER SIZE 00079390
LR R9,R1 ALSO L'RESPBUF TO RY+1 FOR DIAG 8 00079780
SRL R1,3 CONVERT TO DOUBLEWORDS 00080170
HCPGETST LEN=(R1) GET A RESPONSE BUFFER 00080560
LR R7,R1 MOVE A(RESPBUF) TO RX+1 FOR DIAG 8 00080950
ST R1,SAVEWRK1 SAVE BUFFER ADDRESS FOR HCPRELST 00081340
./ R 00083000 § 83290 290 11/26/03 09:42:05
LR R4,R8 COPY 1ST LEVEL RC 00083290
C R8,PFX1 IS RESPONSE HCP001E? 00083580
./ R 00086000 00088000 § 86690 690 11/26/03 09:42:05
DATA=((R7),(R9)) 00086690
* DESTINATION=TERMINAL 00087380
B RELBUF 00088070
./ I 00092000 § 92200 200 11/26/03 09:42:05
A R4,THIRTYK DISTINGUISH FROM NO LOCAL CMD 00092200
RELBUF DS 0H 00092400
L R5,SAVEWRK1 RELOAD ADDRESS OF RESPONSE BUFFER 00092600
HCPRELST BLOCK=(R5) RELEASE DIAG 8 RESPONSE BUF 00092800
./ I 00093000 § 93100 100 11/26/03 09:42:05
NOTLVL2 DS 0H
HCPCONSL WRITE, X00095000
DATA='??? NOT RUNNING IN A SECOND LEVEL VM.', X00096000
DESTINATION=TERMINAL 00097000
L R4,THIRTYK SPECIAL RC 00098080
LA R4,8(0,R4) NOT 2ND LEVEL VM: RC=8 00098160
B EXIT
./ R 00098000 § 98080 80 11/26/03 09:42:05
L R4,THIRTYK SPECIAL RC 00098080
LA R4,4(0,R4) NO CMD: RC=4 00098160
B EXIT 00098240
TOOLONG DS 0H COMMAND WAS > 240, TOO LONG. 00098320
HCPCONSL WRITE, X00098400
DATA='??? DIAGNOSE 8 LIMITED TO 240 CHARACTERS', X00098480
DESTINATION=TERMINAL 00098560
L R4,THIRTYK SPECIAL RC 00098640
LA R4,12(0,R4) TOO LONG: RC=12 00098720
* 00098800
./ R 00100000 00101000 § 100990 990 11/26/03 09:42:05
ST R4,SAVER2 RETURN CODE, SPECIAL OR FROM HOST CP 00100990
./ I 00109000 § 109500 500 11/26/03 09:42:05
THIRTYK DC F'30000' 30,000 CONSTANT FOR SPECIAL RCODES 00109500
./ D 00111000 00114000 11/26/03 09:42:05
* * * END OF FILE * * *
================= CP1STL EXEC =============
CP1STL EXEC M1; V 49 BLKS=1 COL=1 REC=1 OF 29 FILES=1
====>
/* */
ARG LPARM .
IF LPARM = 'LOAD'
THEN DO
'CPACCESS MAINT 191 X RR SYNCH'
'CPXLOAD CP1STL TXTLHOST X NOCONTROL TEMP'
'DEF COM HOST EPNAME CP1STLIN PRIV ABC IBM B'
'ENABLE CMD HOST'
'CPREL X'
END
IF LPARM = 'UNLOAD'
THEN DO
'DISABLE CMD HOST'
'PIPE (END ?)',
'CP QUERY CPXLOAD ³',
'A: NLOCATE W1.2 /LOADED AS/ ³',
'B: NLOCATE W1 /FILE:/ ',
'? A: ³',
'C: FANINANY ³',
'JOIN 1 ³',
'LOCATE /CP1STL/ ³',
'SPECS W4 1 ³',
'VAR LOADID',
'? B: ³',
'C:'
'CPXUNLOAD ID' LOADID
END
* * * END OF FILE * * *