Determining batch/TSO/CICS in assembler

This forum provides the support of Dezhi Mainframe systems. Please post your questions about logon, usage of our mainframe environment.

Moderators: sysprog, prino, sfan, steve-myers, Tim001

Determining batch/TSO/CICS in assembler

Postby tdarcos » Sat 22 Feb 2014, 01:00

I am trying to figure out how to set a flag in an assembly program that determines whether the program is running on batch or on TSO or how you can do input and output that work on both TSO and Batch. Now, on batch you can create a DSN with DSNAME=SYSPRINT and DSNAME=SYSIN and do that, and on TSO you can use TPUT (and probably TGET), at least the IBM manuals make that clear, but I'm not sure how to create a program that can run either in batch or on TSO by determining which it's on.

At least I know how to execute, for batch you use EXEC PGM=modulename and point the joblib to the PDS that contains that member. On TSO you use the CALL statement referencing the PDS. Maybe I should ask if there's a difference if the assembly program is running from ISPF instead of from the TSO command line.

I never found out what it was for reading and writing to the terminal in TSO because we didn't have it; for the terminal monitor we had MUSIC/SP which had MVS emulation, and we ran VM so we submitted batch jobs to MVS, and MUSIC/SP supported use of OPEN/CLOSE on a DSN, so on MUSIC/SP you could run them the same way on either or you could define sysprint/sysin to point to the terminal. (Actually, if you were running on MUSIC/SP you could also use WTO/WTOR which is clearly out of the question for a batch task!)

Oh, I probably also should ask how a program can know if it's running on CICS too. So that it can determine which of the three environments it's on and adjust accordingly.

Either a quick how or a pointer to a place where they tell how would be appreciated.
Paul Robinson <paul@paul-robinson.us> http://paul-robinson.us (My Blog)
"The lessons of history teach us - if they teach us anything - that no one learns the lessons that history teaches us."
tdarcos
 
Posts: 11
Joined: Tue 12 Nov 2013, 14:37

Re: Determining batch/TSO/CICS in assembler

Postby steve-myers » Sat 22 Feb 2014, 03:34

I sent to your ID via XMIT a little Assembler program to determine if the environment is TSO (return code 4) or something else (return code 0). It locates a control block called a Subsystem Identification Block (SSIB). The SSIB has the JESx job ID in it; it tests if the first byte is T (TSO) and uses that to set the return code.
steve-myers
 
Posts: 452
Joined: Tue 04 May 2010, 15:43

Re: Determining batch/TSO/CICS in assembler

Postby steve-myers » Sat 22 Feb 2014, 03:57

Code: Select all
ENVIRON  RSECT
         PUSH  PRINT
         PRINT NOGEN
         CVT   DSECT=YES
         IKJTCB ,
         IEZJSCB ,
         IEFJSSIB ,
         POP   PRINT
ENVIRON  RSECT
         USING *,2
         SAVE  (14,2),,'ENVIRON &SYSDATE &SYSTIME'
         LR    2,15
         L     15,CVTPTR
         L     15,CVTTCBP-CVTMAP(,15)
         L     15,4(,15)
         L     15,TCBJSCB-TCB(,15)
         L     14,JSCBSSIB-IEZJSCB(,15)
         SR    15,15
         CLI   SSIBJBID-SSIB(14),C'T'
         BNE   *+L'*+4
         LA    15,4
         RETURN (14,2),T,RC=(15)
         DC    0D'0'
         END   ENVIRON
steve-myers
 
Posts: 452
Joined: Tue 04 May 2010, 15:43


Return to Dezhi systems: Mainframe

Who is online

Users browsing this forum: No registered users and 0 guests