zowe / zowe-install-packaging

Packaging repository for the Zowe install scripts and files
Eclipse Public License 2.0
27 stars 52 forks source link

JCL header in SZWESAMP templates #3934

Open Martin-Zeithaml opened 1 month ago

Martin-Zeithaml commented 1 month ago

Problem: my ESM does not allow me to run a job without an account number.

Simple JOB statement 1 line JOB statement could be done with combination of defaults.yaml and templating:

And user can specify or omit the variable:

When processed by ZWEGENER, the result will be one of:

But how to do multiline?

What if I want to have this:

//ZWEJOB JOB (800,'Skynet cleaning services'),
//      'Cyberdyne T-800',
//      NOTIFY=(SKYNET.HQ)

or this?

//ZWEJOB JOB (800,'Skynet cleaning services'),
//      'Cyberdyne T-800',NOTIFY=(SKYNET.HQ)

Note: This feature depends on #3718.

Another limitation: Varibale names in ZWEGEN00 must be unique comparing to zowe config, e.g:

zowe:
  environments:
    jcl:
      header: '1234'

was resolved to:

change all {zowe.environments.jcl.header} 'CFG.ZOWE.ENVIRONMENTS.MARTIN.ZOWE.PR#3718.SZWESAMP.HEADER'

Because the rexx variable jcl exists and points to jcllib dataset. 😄

JoeNemo commented 1 month ago

@jordanfilteau1995 Do you (or Judy) know any way to allow subsititution into fixed-80 languages (like JCL, REXX) to properly handle line wrap?

Martin-Zeithaml commented 3 weeks ago

Implementation idea:

  1. defaults.yaml contains zowe.environments.jclHeader='' a) Set it under zowe.environment or zowe.setup?
  2. All samples will be coded with //ZWExxxx JOB {zowe.environments.jclHeader}
  3. zwe init generate will check the header and replace it before submitting ZWEGENER a) the rest of the headers will be replaced by ZWEGEN00

The default behavior is the same, without any additional changes to zowe.yaml, after running ZWEGEN00 there will be always only //ZWExxxx JOB for all samples.

JoeNemo commented 2 weeks ago

Ok, so we are NOT doing multiline.

jordanfilteau1995 commented 2 weeks ago

Hi. I think there's an easier solution. You can:

  1. Make an array of strings in YAML to be and schema enforce to 80-character limit which will correspond to lines in the job card.
  2. Create a step in ZWEGEN00 to handle this.
zowe:
  jobCard:
  - //ZWExxxx JOB BLAHBLAH
  - //      blah

pseudo code below

read YAML job card into jobCard

for all members: read member into a stem fileContents create a new stem newFile loop jobCard contents into newFile stem and store the ending index loop fileContents starting at the ending index until you have newFile with the old file contents after the job card write newFile to member

MarkAckert commented 2 weeks ago

I like the array of fixed-length strings representing multiple header lines, however, I think we should leave out the //ZWExxx JOB portion of the first line and reduce the per-line length limit to adjust accordingly. Users don't need to customize the jobname and leaving it out simplifies some of the implementation work.

jordanfilteau1995 commented 2 weeks ago

Good point! Should not include it and then skip the first line after reading the file to not overwrite it.

Martin-Zeithaml commented 2 weeks ago

I have this working POC and it is just couple lines added to #3951 1) You will define your jcl statement as one string. If you need multiline, use \n (rexx does not know about arrays) 2) zwe init generate checks, if it is one or more lines a) One line will be done directly by REXX ZWEGEN00 b) Multiline will be done by postprocessing in zwe init generate

Templates remain the same:

//ZWExxxx JOB {jclHeader}
Yaml Result
No jclHeader //ZWExxxx JOB
jclHeader=1234 //ZWExxxx JOB 1234
jclHeader=1234,\n// NOTIFY=&ALL //ZWExxxx JOB 1234,
// NOTIFY=&ALL
MarkAckert commented 2 weeks ago

Adding another potential requirement: while using the z/OSMF configuration workflow, can we pass the job card defined in z/OSMF to the templates?