I have not followed all your pointers logic here, but I suspect this may fail when presented with a site where the SWA (Scheduler Work Area) is placed above the 16M line.
Lennie Dymoke-Bradshaw https: //rsclweb.com -----Original Message----- From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> On Behalf Of Cameron Conacher Sent: 25 March 2024 23:46 To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: How can I determine MVS FQDSN from DD Name in Batch COBOL Program? Hello, In case anyone needs this….. it seems to work so far. I did not really need the FQDSN. All I needed to know was whether or not SYSOUT was assign to SPOOL. * * Work area for the MVS Control Block variables. * 01 WS-CONTROL-BLOCK-VARIABLES. 05 WS-CBV-JOB-NUMBER PIC X(08). 05 WS-CBV-JOB-NAME PIC X(08). 05 WS-CBV-PROGRAM-NAME PIC X(08). 05 WS-CBV-PROC-STEP-NAME PIC X(08). 05 WS-CBV-JOB-STEP-NAME PIC X(08). 05 WS-CBV-USER-ID PIC X(08). 05 WS-CBV-USER-NAME PIC X(20). 05 WS-CBV-PROGRAMMER-NAME PIC X(20). 05 WS-CBV-GROUP-NAME PIC X(20). 05 WS-CBV-FOUR-BYTES. 10 WS-CBV-FULL-WORD PIC S9(08) COMP. 10 WS-CBV-PTR-UNAM REDEFINES WS-CBV-FULL-WORD POINTER. 05 WS-CBV-SUB PIC S9(04) COMP. 05 WS-CBV-TIOELINK PIC X(01). 88 WS-CBV-DDNAME-FOR-DSN VALUE X'00'. 88 WS-CBV-DDNAME-FOR-SPOOL VALUE X'02'. * * USED WHEN PARSING MVS CONTROL BLOCK DATA. * 01 LS-CB-POINTER-AREA-1. *> PSA 05 LS-CB-POINTER POINTER OCCURS 512 TIMES. * * USED WHEN PARSING MVS CONTROL BLOCK DATA. * 01 LS-CB-POINTER-AREA-2. 05 LS-CB-POINTER2 POINTER OCCURS 512 TIMES. * * * * Get Job Name, Job Step Name and Proc Step Name from * TIOT Control Blocks. * See Volume #4 of the MVS Data Areas Page #855. * SET ADDRESS OF LS-CB-POINTER-AREA-1 TO LS-CB-POINTER (136) *> TCB SET ADDRESS OF LS-CB-POINTER-AREA-2 TO LS-CB-POINTER (004) *> TIOT MOVE LS-CB-POINTER-AREA-2 (1:8) TO WS-CBV-JOB-NAME *> JOBNAME MOVE LS-CB-POINTER-AREA-2 (9:8) TO WS-CBV-PROC-STEP-NAME MOVE LS-CB-POINTER-AREA-2 (17:8) TO WS-CBV-JOB-STEP-NAME * * Iterate over all the DDNAME entries looking for SYSOUT. * We want to know if it is assigned to SPOOL or not. * * In Production DISPLAYs are ignored, so if we are in * Production and SYSOUT is being sent to the SPOOL, we want * to be able to disable Tracing. * On the other hand if SYSOUT is being sent to a DataSet, * we want to honor the JOB Tracing Parameter for Production. * PERFORM VARYING WS-CBV-SUB FROM +25 *> Start of DDNAME Table BY +20 *> Size of DDNAME Table Entry UNTIL WS-CBV-SUB > 1120 OR LS-CB-POINTER-AREA-2 (WS-CBV-SUB + 4:08) = LOW-VALUES *> End of Table IF LS-CB-POINTER-AREA-2 (WS-CBV-SUB + 4:08) = 'SYSOUT ' MOVE LS-CB-POINTER-AREA-2 (WS-CBV-SUB + 3:01) TO WS-CBV-TIOELINK *> Spool? MOVE +1120 TO WS-CBV-SUB *> Stop Loop END-IF END-PERFORM * * Get Program Name and Job Number from JSCB Control Blocks. * SET ADDRESS OF LS-CB-POINTER-AREA-2 TO LS-CB-POINTER (46) *> JSCB MOVE LS-CB-POINTER-AREA-2 (361:8) TO WS-CBV-PROGRAM-NAME SET ADDRESS OF LS-CB-POINTER-AREA-2 TO LS-CB-POINTER2 (80) *> SSIB MOVE LS-CB-POINTER-AREA-2 (13:8) TO WS-CBV-JOB-NUMBER *> JOBNUM * * Get RACF ID from ASCB Control Blocks. * SET ADDRESS OF LS-CB-POINTER-AREA-1 TO NULL SET ADDRESS OF LS-CB-POINTER-AREA-1 TO LS-CB-POINTER (138) *> ASCB SET ADDRESS OF LS-CB-POINTER-AREA-2 TO LS-CB-POINTER (28) *> ASXB MOVE LS-CB-POINTER-AREA-2 (193:8) TO WS-CBV-USER-ID *> RACF ID * * Get RACF Group from ACEE Control Blocks. * SET ADDRESS OF LS-CB-POINTER-AREA-2 TO LS-CB-POINTER2 (51) *> ACEE MOVE LS-CB-POINTER-AREA-2 (31:8) TO WS-CBV-GROUP-NAME *> GROUP * * Get Long Name from UNAM Control Blocks. * SET ADDRESS OF LS-CB-POINTER-AREA-1 TO LS-CB-POINTER2 (26) *> UNAM MOVE ZERO TO WS-CBV-FULL-WORD MOVE LS-CB-POINTER-AREA-1 (1:1) TO WS-CBV-FOUR-BYTES (4:1) MOVE LS-CB-POINTER-AREA-1 (2:WS-CBV-FULL-WORD) TO WS-CBV-USER-NAME *> NAME . Thanks …….Cameron Note I will be OOO on PTO March 23 throough March 31 2024 inclusive. From: IBM Mainframe Discussion List <IBM-MAIN@LISTSERV.UA.EDU> On Behalf Of Sri Hari Kolusu Sent: Monday, March 25, 2024 12:06 PM To: IBM-MAIN@LISTSERV.UA.EDU Subject: Re: How can I determine MVS FQDSN from DD Name in Batch COBOL Program? >> Why? Well I would like my COBOL program to allow COBOL Displays in >> Production ONLY when the User specified a FQDN. Cameron, Check this. >> https: //www. mvsforums. com/helpboards/viewtopic. php?p=62866 >> Thanks, Kolusu >> --------------------------------------------------------------------- >> - >> Why? Well I would like my COBOL program to allow COBOL Displays in >> Production ONLY when the User specified a FQDN. Cameron, Check this. https://www.mvsforums.com/helpboards/viewtopic.php?p=62866<https://isolate.menlosecurity.com/1/3735928037/https:/www.mvsforums.com/helpboards/viewtopic.php?p=62866> Thanks, Kolusu ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu<mailto:lists...@listserv.ua.edu> with the message: INFO IBM-MAIN ________________________________ American Express made the following annotations ________________________________ This e-mail was sent to you by a representative of Amex Bank of Canada, P.O. Box 3204, Station "F", Toronto, ON, M1W 3W7, www.americanexpress.ca. If you no longer wish to receive these e-mails, please notify the sender by reply e-mail. This e-mail is solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this e-mail is prohibited. If you have received this e-mail in error, please notify the sender by reply e-mail and immediately and permanently delete this e-mail and any attachments. Thank you. American Express a fait les remarques suivantes Ce courriel vous a été envoyé par un représentant de la Banque Amex du Canada, C.P. 3204, succursale F, Toronto (Ontario) M1W 3W7, www.americanexpress.ca. Si, par la suite, vous ne souhaitez plus recevoir ces courriels, veuillez en aviser les expéditeurs par courriel. Ce courriel est réservé au seul destinataire indiqué et peut renfermer des renseignements confidentiels et privilégiés. Si vous n’êtes pas le destinataire prévu, toute divulgation, duplication, utilisation ou distribution du courriel est interdite. Si vous avez reçu ce courriel par erreur, veuillez en aviser l’expéditeur par courriel et détruire immédiatement le courriel et toute pièce jointe. Merci. ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN