For in-stream data sets: with the SH option, trailing blanks are not truncated. 
Records in in-stream data sets are concatenated with blanks as separator 
characters, and the string remaining after the SH token is passed as a single 
argument to a /bin/sh -c command. For the PGM option, the string is divided not 
only at line boundaries but also at blanks within a line.

>From "Guidelines for defining STDPARM", 
>https://www.ibm.com/support/knowledgecenter/SSLTBW_2.4.0/com.ibm.zos.v2r4.bpxa400/gfdstdparm.htm

The wording is a bit problematic, but essentially in STDPARM only, a new line 
is treated as a space character.  You can only pass a single "line", then, when 
using STDPARM.  I also think the statement that "with the SH option, trailing 
blanks are not truncated" is not true at all.  The next "page" in the manual, 
"Ways to define STDPARM" seem to contradict this.

You can define the STDPARM parameter file by using one of the following:

  *   [...]
  *   An JCL in-stream data set

The BPXBATCH parameter data immediately follows the STDPARM DD statement. 
Trailing blanks are truncated for in-stream data sets, but not for other data 
sets.

The following is one way to define STDPARM to run the script:

//STDPARM  DD *
SH /myscript.sh AAAA BBBB CCCC
/*

Here is another way, placing the arguments on separate lines:

//STDPARM  DD *
SH /myscript.sh AAAA
BBBB
CCCC
/*[Copy code]

Result: Both of these STDPARM definitions produce the following output:

AAAA
BBBB
CCCC




________________________________
From: IBM Mainframe Discussion List <[email protected]> on behalf of 
Paul Gilmartin <[email protected]>
Sent: Friday, January 15, 2021 9:51 AM
To: [email protected] <[email protected]>
Subject: Re: JCL to tar USS directory

On Fri, 15 Jan 2021 10:12:52 -0500, Kurt Quackenbush wrote:

>On 1/14/2021 10:10 AM, Bill Giannelli wrote:
>> can anyone provide JCL to tar a USS directory?
>//PAX      EXEC PGM=BPXBATCH
>//STDPARM  DD *
>PGM /bin/pax -zvwf /u/user/paxfile.pax.Z
>/directory/to/be/paxed/
>/*
Must that second line be indented so it is not abbutted to the first, resulting 
in:
    PGM /bin/pax -zvwf /u/user/paxfile.pax.Z/directory/to/be/paxed/
... ???  The manual,
    z/OS  Version 2 Release 4
    UNIX System Services Command Reference
    IBM  SA23-2280-40

 needs clarification here.  And in

    From a TSO command environment, the parameter string itself will now
    support up to 32754 characters.

Doesn't TSO CALL impose a limit of 100?

    Parameters to BPXBATCH can also be supplied via the stdparm DD up to a 
limit of 65,536 characters.

65,536?  65,535 is more plausible.

    In addition, program_name can contain option information.

My experience has been that after SH the remainder of the PARM is passed
as the command-string to "sh -c 'command-string'".

When PGM is specified, the PARM is tokenized at blanks. The first token is
the program (path)name; remaining tokens are arguments to the program.

    When PGM and program_name are specified and the specified program name
    does not begin with a slash character (/), BPXBATCH prefixes the user's 
initial
    working directory information to the program path name.

"initial working directory"?  I'd expect "current" working directory.
What about when SH is specified?

>//STDOUT   DD SYSOUT=*
>//STDERR   DD SYSOUT=*
>
    5. BPXBATCH does not support any ddnames other than stdin , stdout, stderr,
       stdenv or stdparm. Attempting to allocate or reference any other ddnames
       will result in enqueue failures or unpredictable results. To use an MVS 
data set
       in your batch UNIX application, use "dynamic allocation", such as SVC99 
or
       the TSO ALLOC command. Also, you must remove all "static allocations"
       (ddnames referring to the MVS data set in question) from all steps in the
       batch job.

How many misstatements or misleading statements are in that paragraph?
Certainly static (JCL) allocation is less susceptible to enqueue failures than
dynamic allocation.

-- gil

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to