On Sun, 6 Oct 2019 18:06:16 +0000, Jon Perryman wrote: > >I'm saying that IBM can't fix this problem because the problem lies with Unix >shell design. This same exact problem exists in products that utilize "sh -c >some-mangled-commands" (e.g. system automation). For those products, it's >considered a bad practice to use script statements (e.g. IF) as part of the >the mangled command. > Why?
The problem lies with JCL design, namely JCL's inability to pass a multi-line PARM. Even use of ";" command stacking should be limited. Instead, a script file is the preferred method. The BPXBATCH STDPARM example in this thread should be a script file because of it's complexity. > >Copying STDPARM to FD0 ( Unix stdin or pipe to stdin) is not an acceptable >solution because commands and programs may consume the script. Script files do >not get consumed. The mangled command does not get consumed. > So, you want it to persist rather than be consumed? >Creating a script file really is not a good option. Unique file names and >finding a directory for the script file can be a problem. Ensuring the script >file is deleted at script termination could be a problem. I'm sure there are >other problems that would need to be resolved. > You're arguing against yourself. Here you seem to want that script to be consumed rather than persist. (sh invisibly creates and deletes temp files for constructs such as command substitution and here-documents.) >Additionally, there are many shells available. All shells support passing a >single line of commands which is the interface designed specifically for >situations such as BPXBATCH. Sadly, shell design doesn't give us the best >solution. > UNIX commands, including shell, accept multiple arguments. The problem lies in BPXBATCH's (in fact all of JCL's) inability to pass multiple arguments. I can't even pass an alternate DDNAME list to a classic utility. POSIX shell allows great complexity in a single line. An example: 695 $ cat x #! /bin/sh : Define a multiple command string: S="p() { echo; echo \"The argument passed was:\"; echo \" \$1\"; return; }; p foo; p bar" : Execute it with sh: /bin/sh -c "$S" 696 $ ./x The argument passed was: foo The argument passed was: bar 697 $ ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN