View previous topic :: View next topic |
Author |
Message |
southskies Beginner
Joined: 14 Jul 2008 Posts: 9 Topics: 4
|
Posted: Fri Jul 24, 2009 12:29 am Post subject: Connecting to Unix - no output |
|
|
Hi,
I'm trying to learn more abount the Unix function on the mainframe.
I've got a very simple job.
Code: |
//STEP02 EXEC PGM=BPXBATCH,REGION=0M
//SYSOUT DD SYSOUT=*
//STDOUT DD SYSOUT=*
//STDERR DD SYSOUT=*
//STDIN DD *
LS -1
|
When I execute it, all I get is: Code: |
*---------------------------------------------------------------
/etc/profile 1.17 was executed
Java version: J5.0
*---------------------------------------------------------------
|
Where does the output go?
Thanks!
Steve |
|
Back to top |
|
|
Ram Beginner
Joined: 12 Jan 2004 Posts: 53 Topics: 12
|
Posted: Fri Jul 24, 2009 3:31 am Post subject: |
|
|
Steve,
The o/p of the unix command is directed to the dataset addressed by STDOUT dd name. Depending on the msgclass settings, the o/p could be lying in the spool. If you intend to copy the o/p to a HFS file then make these changes to your JCL ..
Code: | STDOUT DD PATH='/home/dir1/stdout.txt',
PATHOPTS=(OWRONLY,OCREAT,OTRUNC),PATHMODE=SIRWXU |
Hope this answers your query.
Thanks,
Ram |
|
Back to top |
|
|
Ram Beginner
Joined: 12 Jan 2004 Posts: 53 Topics: 12
|
Posted: Fri Jul 24, 2009 8:58 am Post subject: |
|
|
Is this 'LS -1 ' a typo ? try ls -l to list the directory contents. |
|
Back to top |
|
|
southskies Beginner
Joined: 14 Jul 2008 Posts: 9 Topics: 4
|
Posted: Sun Jul 26, 2009 8:43 pm Post subject: Still no output |
|
|
Thanks Ram,
I was getting output coming through the STDOUT DDname, but all I got written out here was
*---------------------------------------------------------------
/etc/profile 1.17 was executed
Java version: J5.0
*---------------------------------------------------------------
I've fixed up the ls -1 to be ls -l. Still no output through.
Steve |
|
Back to top |
|
|
taltyman JCL Forum Moderator
Joined: 02 Dec 2002 Posts: 310 Topics: 8 Location: Texas
|
Posted: Mon Jul 27, 2009 10:30 am Post subject: |
|
|
Probably doesn't matter but I typically use PARM= to pass input. Like this.
//BPX EXEC PGM=BPXBATCH,
// PARM='SH whatever command I want to issue' |
|
Back to top |
|
|
tcb Beginner
Joined: 07 Nov 2005 Posts: 14 Topics: 1
|
Posted: Mon Jul 27, 2009 11:06 am Post subject: |
|
|
Hi, Steve.
You can try this:
Code: |
//TSO EXEC PGM=IKJEFT01
//SYSEXEC DD DISP=SHR,DSN=SYS1.SBPXEXEC
//SYSTSPRT DD SYSOUT=*
//SYSTSIN DD *
OSHELL ls -al
|
|
|
Back to top |
|
|
Ram Beginner
Joined: 12 Jan 2004 Posts: 53 Topics: 12
|
Posted: Mon Jul 27, 2009 11:14 am Post subject: |
|
|
Correct me if I am wrong, list directory command would list the default directory contents. In this case, the users home directory. If you dont have a home directory or access to it, you will not see any o/p from the ls command. |
|
Back to top |
|
|
tcb Beginner
Joined: 07 Nov 2005 Posts: 14 Topics: 1
|
Posted: Mon Jul 27, 2009 11:50 am Post subject: |
|
|
Ram,
you will get
Code: |
ls: FSUM6785 File or directory "/asdasd" is not found
|
|
|
Back to top |
|
|
southskies Beginner
Joined: 14 Jul 2008 Posts: 9 Topics: 4
|
Posted: Mon Jul 27, 2009 7:39 pm Post subject: |
|
|
Its a puzzle to me. I can go into native tso and type the oshell ls -al command and it works fine...
so why does batch work differently? |
|
Back to top |
|
|
videlord Beginner
Joined: 09 Dec 2004 Posts: 147 Topics: 19
|
Posted: Tue Jul 28, 2009 9:19 am Post subject: |
|
|
try LS -l 1>STDOUT 2>STDERR |
|
Back to top |
|
|
videlord Beginner
Joined: 09 Dec 2004 Posts: 147 Topics: 19
|
Posted: Tue Jul 28, 2009 9:58 am Post subject: |
|
|
1. shell command should be input in PARM, using PARM='SH your unix command' or
Code: | //STDPARM DD *
SH your unix command
|
2. BPXBATCH run shell comand, should start with SH
3. STDIN must be z/OS UNIX file |
|
Back to top |
|
|
Ram Beginner
Joined: 12 Jan 2004 Posts: 53 Topics: 12
|
Posted: Tue Jul 28, 2009 1:26 pm Post subject: |
|
|
Steve,
As videlord has correctly pointed out, commands supplied via STDIN should be stored in a HFS. Else pass the commands through parm option and you should be able to see the o/p in STDOUT.
Cheers,
Ram |
|
Back to top |
|
|
|
|