On Thu, 12 Oct 2023 11:45:48 +0000, Joseph Reichman <[email protected]>
wrote:
> I looked thru the manuals to create an actual control block
> or structure think you need assembler just give me a hint how I would go abou
> this task In Rexx
Everyone needs to stop making IPCS more difficult than it really is. It's been
a really long time for me, so everything I say here will be conceptual and you
will need to look up the real commands. I'm not going to include everything
here.
* REXX STORAGE() has nothing to do with IPCS. If you need help with it, then
start another thread.
* Almost everything you write for IPCS in assembler can be written in REXX.
Sometimes it's simpler and faster in assembler but you can do it in REXX with a
little perseverance.
* Most IPCS subcommands intentionally do not return data to REXX because it
doesn't make sense. These subcommands greatly simplify the displaying dump
data. For instance, let's say you want to display all the ASCB's, TCB's and
RB's. You do it as follows:
ADDRESS IPCS RUNCHAIN ADDR(first_ASCB_address) LINK(ASCBNEXT) EXEC((TSO
%ASCB_FORMAT).
ASCB_FORMAT REXX:
ADDRESS IPCS CBFORMAT X CB(ASCB)
ADDRESS IPCS RUNCHAIN ADDR(X+ASCB_FIRST_TCB_offset) LINK(TCBNEXT_offset)
EXEC((TSO %TCB_FORMAT)
exit
TCB_FORMAT REXX:
ADDRESS IPCS CBFORMAT X CB(TCB)
ADDRESS IPCS RUNCHAIN ADDR(X+TCB_FIRST_RB_offset) LINK(RBNEXT_offset)
EXEC((TSO %RB_FORMAT)
exit
RB_FORMAT REXX:
ADDRESS IPCS CBFORMAT X CB(RB)
EXIT
* If you prefer assembler, I'm guessing there is an IPCS exit service which
allows you to do a CBFORMAT. You could run the chains from assembler calling
CBFORMAT but the only difference is that assembler is compatible with offset
changes where as REXX requires you modify the command.
* Coding "ADDRESS IPCS" at the beginning of your REXX eliminates the need to
code it on every IPCS subcommand.
* REXX can issue all IPCS subcommands like those issued from IPCS option 6 or
from the IPCS command line. E.g ADDRESS IPCS VERBEXIT VSMDATA.
* Assembler BLSQ macros are very convenient to display your control blocks
using ADDRESS IPSC CBFORMAT. They are NOT intended for your REXX to extract
control block fields.
* IPCS subcommands beginning with "EVAL" can return data to REXX. The single
most useful is "EVALUATE" which returns the requested data to your REXX exec.
For example, EVALUATE ADDR(121734.) LENGTH(500) REXX(MYDATA) fills the MYDATA
variable with 500 bytes located at address 121734. Hint, if you need most of a
control block, then get the entire CB but if you only need a couple fields,
then get a couple fields.
* It's possible to display control blocks using REXX directly but if you have
more than a couple of fields to display, I strongly encourage you to code BLSQ
assembler macros and use CBFORMAT. In REXX, you would use the following REXX to
display MYDATA from the previous bullet point.
ADDRESS IPCS NOTE "'MYDATA: CHAR "substring(mydata,10,20) "HEX
"c2x(substring(mydata,200,4))"'"
* REXX C2X() makes hex data human readable
REXX C2D() and X2D() make data decimal allowing you to do arithmetic operation
like adding a base address and offset giving you the address of the desired
field.
REXX D2X() and D2C() converts a number to either human readable hex or actual
byte characters (e.g. 3 = F3 or x'F3')
* Coding BLSQ assembler. I have several control blocks. Any CB change only
needs a re-assemble of the mapping program. The following is the basic logic
(not my real code):
MACRO ,
#SETUP , Setup for IPCS CBFORMAT mapping
R_DSECT OPSYN DSECT save real DSECT
DSECT OPSYN #DSECT make DSECT a macro
R_DS OPSYN DS save real DS
DS OPSYN #DS make DS a macro
R_DC OPSYN DC save real DC
DC OPSYN #DC make DC a macro
R_EQU OPSYN EQU save real EQU
EQU OPSYN #EQU make EQU a macro
MEND ,
MACRO ,
#RESTORE , Restore real instructions
DSECT OPSYN R_DSECT
DS OPSYN R_DS
DC OPSYN R_DC
EQU OPSYN R_EQU
MEND ,
MACRO ,
&L #DSECT ,
&L R_DSECT &SYSLIST
AINSERT 'BLSQ statement for DSECT'
MEND ,
MACRO ,
&L #DS ,
&L R_DS &SYSLIST
AINSERT 'BLSQ statement for DS'
*** Offset is from the DSECT (or CSECT)
*** field length is L'&L
*** field length 1 might be a flag followed by equates describing each bit
*** If you used multipliers or multiple fields, then you must consider them.
*** T'&L gives you X, A, C and ??? which determines if you need hex display,
char or ???
MEND ,
MACRO ,
&L #DC ,
&L R_DC &SYSLIST
AINSERT 'BLSQ statement for DC'
*** Offset is from the DSECT (or CSECT)
*** field length is L'&L
*** If you used multipliers or multiple fields, then you must consider them.
*** field length 1 might be a flag followed by equates describing each bit
*** T'&L gives you X, A, C and ??? which determines if you need hex display,
char or ???
MEND ,
MACRO ,
&L #EQU ,
&L R_EQU &SYSLIST
AINSERT 'BLSQ statement for EQU'
***
*** field length 1 might be a flag followed by equates describing each bit
*** T'&L gives you X, A, C and ??? which determines if you need hex display,
char or ???
MEND ,
MACRO ,
&C #CREATE &CB=
#SETUP ,
&CB DSECT=YES
#RESTORE ,
&C CSECT ,
MEND ,
TCB #CREATE CB=IKJTCB
END ,
* Creating REXX compatible control block mapping is fast and simple using the
technique. Instead of coding BLSQ macros, create a table of names with offsets
that the REXX will use to convert names to offsets. Call the program using
ADDRESS LINKPGM passing the desired field name.
* If you absolutely must capture IPCS command output, then use IPCS file output
or REXX SYSOUTTRAP but remember that it will require you set and restore IPCS
settings.
* Avoid REXX LINK, LINKMVS and LINKPGM because VERBEXIT is the preferred method
for calling an IPCS compatible program which is documented as having an IPCS
services compatible environment. IBM could have written VERBEXIT VSMDATA in
REXX but they found assembler a better solution but does not encourage use of
REXX LINK.
* ADDRESS IPCS NOTE should be the preferred method to print lines because it's
compatible with IPCS line mode and ISPF full screen. Also NOTE avoids screen
flooding and coding REXX ATTN routine. Use of REXX SAY, putline, WTO and other
methods should only be used when they are truly needed.
* All IPCS commands can be used by hand or in a REXX exec. I think that even
evaluate can be entered by hand, but it's output would be far less usable than
the list command.
* Clearly define the actual problem being solved. Not once have you stated the
actual problem you are solving. Instead, you give us your vision of the
solution. It's great to start with a vision but there are many ways to solve a
problem and you might not be solving it correctly.
This is probably incomplete, but it should be enough for you to figure it out.
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN