Interestingly, this is something being discussed in our shop right now. We have an application with code that extracts a DSN by searching through the TIOT, in order to perform some security check. We (z/OS support division) fear that this user code is vulnerable to changes in z/OS control block layout, with the possibility of having one of your LOB (Line Of Business) apps down. The app people even asked if IBM would warn them of such cblock changes:
"Has IBM ever remapped the MVS Control blocks that a batch application program accesses? Will IBM ever remap the MVS Control blocks that a batch application program will access? How safe would it be for COBOL application code to access these MVS Control Blocks?" We know IBM doesn't provide COBOL code mapping the TIOT, so we believe it's possible for an application to be unexpectedly crippled by a subtle z/OS control block change, with management asking for delays (and/or back out) of the latest z/OS rollout. Shouldn't every effort be made to insulate appl code from the OS ? I fear the day wil come when we'll have to forward the SMP APPLY CHECK listing to all application programmers. Do your shop(s) have a policy of sorts when it comes to accessing such data (outside of any LE service) ? Stan Canada Revenue Agency mailto:[email protected] (613) 941-8091 -----Original Message----- From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf Of Giliad Wilf Sent: June 23, 2011 8:43 AM To: [email protected] Subject: Re: Obtaining System Information from a COBOL program On Wed, 22 Jun 2011 12:36:13 -0500, Daniel Rose <[email protected]> wrote: >I had a COBOL programmer ask me how they could get the LPAR name, SYSNAME, >or SMFSID from a COBOL program. I could not find a LE Function that would >do that. So, a co-worker located a sample program that chases controls to >get that information. > >Does anybody know of any LE Functions or a cleaner way to do this. > >BTW, the programmer does not want to add a SORT step before the COBOL >program nor do they want to change the execution JCL. Hence the restriction >of only obtaining this from inside the COBOL program. > AFAIK, there is no LE run-time service for this. However, we use code similar to the quoted below to interrogate system control blocks and extract what we need. The code addresses control blocks by manipulating POINTER data items, and by reference modifier in parentheses. The "Inspect" command translates x'FA' to the character A, x'FB' to B,...x'FF' to F. CBL QUOTE,OPT,DUMP,RENT,DATA(31) ID Division. Program-ID. SYSWALK. Environment Division. Input-Output Section. Data Division. Working-Storage Section. 01 F-B. 05 PT4 Pointer. 05 PL4 Redefines PT4 PIC 9(7) COMP-3. 05 XL4 Redefines PT4 PIC X(4). 05 ZL5 PIC 9(5). 05 CL4 Redefines ZL5 PIC X(4). 01 Huge-Area. 05 filler PIC X(1024) Occurs 16383. Linkage Section. 01 CB. 05 PTR Pointer Occurs 512. Procedure Division. * Address PSA (zero address) Set Address Of CB To NULL * Address CVT by picking 5th word of PSA (x'10') Set Address Of CB To PTR(5) * Pick CVTDATE from CVT + x'38' (0cyydddF) Move CB(57:4) To XL4 * Convert 0cyydddF to yyyydddF Add 1900000 To PL4 Display "Date (yyyyddd): " PL4 * Address SMCA by picking 50th word of CVT (x'C4') Set Address Of CB To PTR(50) * Pick system name from SMCA + x'10' Display "System name: " CB(17:4) * Address PSA (zero address) again Set Address Of CB To NULL * Address CVT by picking 5th word of PSA (x'10') Set Address Of CB To PTR(5) * Address System Residence UCB Set Address Of CB To PTR(13) * Pick VOLSER at UCB + x'1C' Display "SYSRES: " CB(29:6) * Pick Unit Address at UCB + x'4' Move Zero To PL4 Move CB(5:2) To XL4(2:2) Move PL4 To ZL5 Inspect CL4 Replacing All "³" By "A" All "" By "B" All "" By "C" All "‎" By "D" All "‏" By "E" All "." By "F" Display "SYSRES Address: " CL4 * Address PSA (zero address) again Set Address Of CB To NULL * Address CVT by picking 5th word of PSA (x'10') Set Address Of CB To PTR(5) * Address ECVT (Extended CVT) at CVT + x'8C' Set Address Of CB To PTR(36) * Pick sysplex-name at ECVT + x'8' Display "SYSPLEX: " CB(9:8) * Pick hardware-name at ECVT + x'150' Display "HWNAME: " CB(337:8) * Pick LPAR-name at ECVT + x'158' Display "LPAR: " CB(345:8) * Pick VM-name at ECVT + x'160' Display "VM: " CB(353:8) * Pick system VRM at ECVT + x'200' Display "z/OS (vvrrmm): " CB(513:6) * Pick IPL parameter at ECVT + x'A8' Display "LOAD parameter (iiiillpn): " CB(169:8) Goback. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: GET IBM-MAIN INFO Search the archives at http://bama.ua.edu/archives/ibm-main.html

