Guys, A big thanks, I will give these a try and report back ..My first z/OS Unix 'thing', I have worked a bunch of Linux. Let you all know.
Scott On Sat, Mar 17, 2018 at 6:46 PM Paul Gilmartin < 0000000433f07816-dmarc-requ...@listserv.ua.edu> wrote: > On Sat, 17 Mar 2018 19:22:37 +0000, scott Ford wrote: > > >I am trying to understand how to issue a unix via a Cobol Program running > >in Batch ..I found an example IBM supplied... > > > Why would someone use Batch COBOL to run a shell to use TSOCMD to execute > a TSO command? Rube Goldberg? > > > Working-storage section. > > 01 Start-Filler pic x(41) > > value '********** Working Storage Begin ********'. > > 01 exec-path pic x(100). > > 01 exec-path-ptr pointer. > > 01 exec-parm1 pic x(100). > > 01 exec-parm1-ptr pointer. > > 01 exec-parm2 pic x(100). > > 01 exec-parm2-ptr pointer. > > 01 null-ptr pointer value null. > > Local-storage section. > > 01 rc pic s9(9) binary. > > Procedure division. > > Move Z'tsocmd' to exec-path. > > Move Z'SEARCH CLASS(USER)' to exec-parm1 > > Set exec-path-ptr to address of exec-path > > Set exec-parm1-ptr to address of exec-parm1 > > Set exec-parm2-ptr to address of exec-parm2 > > Call 'execl' using by value exec-path-ptr > > by value exec-parm1-ptr > > by value null-ptr > > returning rc > > if rc = 0 then > > display 'tsocmd worked' > > end-if > > Goback. > > > >My problem is how to i route the output back the caller ? I thought if I > >used STDOUT it would , but apparently not. > > > >//ETESTR4 JOB SYSTEMS,MSGLEVEL=(1,1),MSGCLASS=X,CLASS=A,PRTY=8, > >// NOTIFY=&SYSUID,REGION=4096K > >//STEP1 EXEC PGM=CBLUNIX,REGION=0K, > >// PARM='POSIX(ON) ALL31(ON) ENVAR("_CEE_ENVFILE=DD:STDENV")/' > >//STEPLIB DD DSN=IDF.TESTUNIX.LOADLIB,DISP=SHR > >//SYSPRINT DD SYSOUT=* > >//SYSOUT DD SYSOUT=* > >//STDENV DD SYSOUT=* > >/* > As someone has already pointed out, STDENV should be SYSIN, not SYSOUT. > > I believe STDIN, STDOUT, STERR, and STDENV DDs are peculiar to > BPXBATCH. but you could invoke BXBATCH as if it were a standard > batch program > > UNIX programs generally expect stdin, stdout, and stderr to be available. > Otherwise they misbehaive badly. > > I'd be inclined to BPX1OPN /dev/null. BPX1PIP to create a pipe. Invoke > the > UNIX program with BPX1SPN, assigning the null descriptor to descriptor 0 > and the input end of the pipe to both descriptors 1 and 2. DYNALLOC > (BPXWDYN?) > the output of the pipe to a DDNAME and read the program's output from that. > > I've done similar with Rexx, never with COBOL. > > -- gil > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN > -- *IDMWORKS * Scott Ford z/OS Dev. “By elevating a friend or Collegue you elevate yourself, by demeaning a friend or collegue you demean yourself” www.idmworks.com scott.f...@idmworks.com Blog: www.idmworks.com/blog *The information contained in this email message and any attachment may be privileged, confidential, proprietary or otherwise protected from disclosure. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution, copying or use of this message and any attachment is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and permanently delete it from your computer and destroy any printout thereof.* ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN