Page 1 of 1

Using JP# parameters in the JOINKEYS F1/F2 subtask

PostPosted: Tue Mar 27, 2012 4:57 am
by Robert Alford
I've executed a JOINKEYS statement with a F1 subtask via ICETOOL with PARM='JP6"31122012"'

I've noticed that the JP6 does not translate when it's in the JOINKEYS subtask.

If I run the same control card as a main task via a ICETOOL COPY statement, rather than a subtask, the JP6 translation occurs as expected.

ICE282I 0 PERFORMING SYMBOL SUBSTITUTION AS NEEDED   
           INREC  IFTHEN=(WHEN=INIT,                 
                         BUILD=(WP_DATE:JP6,         
                                        $             
ICE283A 0 SYMBOL, SYNTAX OR DELIMITER ERROR           


Is this a bug, or should I expect JP# parameters to translate when in JOINKEYS subtasks?

Re: Using JP# parameters in the JOINKEYS F1/F2 subtask

PostPosted: Tue Mar 27, 2012 5:54 am
by Frank Yaeger
Time to go home. I'll respond to this tomorrow after I check a few things.

Re: Using JP# parameters in the JOINKEYS F1/F2 subtask

PostPosted: Tue Mar 27, 2012 8:43 pm
by BillyBoyo
As a work-around, you could generate a sybol onto a dataset which you concatenate to your SYMNAMES dataset.

So, you have a new step which takes the PARM for the joinkeys step. Generate the a symbol from the parm

//STEP0050 EXEC PGM=SORT,PARM='JP6"A"'
//SYSOUT   DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
 OPTION COPY
  INREC BUILD=(C'TEMP-JP6,C''',JP6,C'''')
//SORTIN DD *
 DUMMY LINE
//SYMNOUT DD SYSOUT=*
//SYMNAMES DD *


Change the SORTOUT to a dataset and concatenate with your SYMNAMES dataset on the JOINKEYS step. Remove, for now, the PARM for JP6 on the JOINKEYS step.

Re: Using JP# parameters in the JOINKEYS F1/F2 subtask

PostPosted: Tue Mar 27, 2012 9:18 pm
by BillyBoyo
Even better to use the SYMNOUT going to a dataset, but needs another step to drop off the stuff you don't want from the symnout, although a hardly-taxing INCLUDE for (1,4,CH,EQ,C'JP6,') should get it done. I was thinking of SELECT earlier, to get the last, but then changed to the above.

The advantage of using the SYMNOUT is that later only the JCL needs to be amended (drop the two new steps, change the PARM for the step with the JOINKEYS, remove the concatenation. Sort deck would stay unchanged.

Re: Using JP# parameters in the JOINKEYS F1/F2 subtask

PostPosted: Wed Mar 28, 2012 1:52 am
by Frank Yaeger
The JOINKEYS subtasks DO NOT have access to the JPn parameters. Only the main task has access. The main tasks and subtasks DO have access to the SYMNAMES data set.

I see it has already been suggested that you set up a SYMNAMES data set with the JPn symbol as a symbol statement and pass that SYMNAMES data set to the JOINKEYS step. You could use a DFSORT/ICETOOL job something like this:

// SET VOL1=SCRTC1
//SUSYM EXEC PGM=SORT,PARM='JP6"&VOL1"'
//SYSOUT DD SYSOUT=*
//SORTIN DD *
RECORD
//SORTOUT DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//SYSIN DD *
  OPTION COPY
  INREC BUILD=(C'JP6,''',JP6,C'''',80:X)
//S1 EXEC PGM=ICETOOL
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=...  input file1
//IN2 DD DSN=...  input file2
//OUT DD DSN=...  output file
//TOOLIN DD *
COPY JKFROM TO(OUT) USING(CTL1)
//CTL1CNTL DD *
  JOINKEYS F1=IN1,FIELDS=(1,5,A)
  JOINKEYS F2=IN2,FIELDS=(1,5,A)
  REFORMAT FIELDS=(F1:11,5,F2:21,5,F1:81,6)
  OPTION COPY
/*
//JNF1CNTL DD *
  INREC  IFTHEN=(WHEN=INIT,
    BUILD=(1,80,JP6))
/*


I would NOT recommend using SYMNOUT for SYMNAMES since it has the wrong attributes (FBA/121 instead of FB/80). But if you do use the SYMNOUT data set, you'll have to copy it and modify it to have the correct attributes as well as the correct symbols.

Re: Using JP# parameters in the JOINKEYS F1/F2 subtask

PostPosted: Wed Mar 28, 2012 8:41 am
by Robert Alford
Frank and Billy,

Thanks for the info.

Good to know officially that JPn parameters do not work in JOINKEYS subtasks.

Very comfortable with the convert JPn to Symbols in the likes of a pre-cursor step.

Cheers,
Rob.