Page 1 of 1

passing a value from file to a Symbolic

PostPosted: Tue Mar 20, 2012 1:33 am
by mathew28
Hi,

I have an input file having some records like shown below

QC12345
12345556
14143142
23423432
24234234
24343444

I need to extract the 1st record "QC12345" and pass it to a Symbolic say Set QCNAME=QC12345
So that i can use it to name the output file DD DSN = XXXX.OUTPUT.&QCNAME., DISP=(NEW,CATLG,DELETE)

I can extract the first record using DFSORT , INREC .
But please help me with the option to pass that value to a Symbolic. Is there any way to pass a value from a file to Symbolic ? Is it possible?

Please advice. Thanks in advance.

Re: passing a value from file to a Symbolic

PostPosted: Tue Mar 20, 2012 3:16 am
by Frank Yaeger
I think you would have to generate a job for the internal reader. You could do that using a symbolic to generate the DSN statement or just generate the DSN statement directly from the input statement. I don't think there's any way to do what you want without seting up a job for the internal reader, but I could be wrong.

Re: passing a value from file to a Symbolic

PostPosted: Tue Mar 20, 2012 5:12 pm
by Thomas Ramseier
I don't know of a way except internal reader as well - except you run a TSO-callable program like DFSORT. In this case, you could avoid the internal reader, which might help you if you run job streams thru scheduling tools (see sample below). We use this logic often to concatenate an unknown/variable number of //SORTIN -
DSNs within one job.

hth

//SETLVL SET FNAME=QC41223
//*
//STEP0000 EXEC PGM=IEFBR14  *This step is for test only - delete datasets allocated later on
//MODELDSN DD DSN=T750K.MODEL.DATA,DISP=(MOD,DELETE,DELETE),
//    UNIT=SYSDA,SPACE=(CYL,(1),RLSE),LRECL=80,RECFM=FB,BLKSIZE=0
//RERUNDSN DD DSN=T750K.TEST.QC41223.CSV.DATA,DISP=(MOD,DELETE,DELETE),
//    UNIT=SYSDA,SPACE=(CYL,(1),RLSE),LRECL=80,RECFM=FB,BLKSIZE=0
//*
//S1 EXEC PGM=SORT,PARM='JP1"&FNAME..CSV"'
//SYSOUT DD SYSOUT=*
//SORTIN DD *
ERC.CSV
//SORTOUT DD DSN=&&NEWDSN1,DISP=(,PASS),
//    UNIT=VIO,SPACE=(1,(1),RLSE),LRECL=80,RECFM=FB
//SYSIN DD *
  INREC FINDREP=(IN=C'ERC.CSV',OUT=JP1)
  OPTION COPY
  OUTREC BUILD=(3:C'DA(''T750K.TEST.',JP1,C'.DATA'') +',
                80:X)
/*
//STEP0010 EXEC PGM=IEFBR14
//MODELDSN DD DSN=T750K.MODEL.DATA,DISP=(NEW,CATLG,DELETE),
//    UNIT=SYSDA,SPACE=(CYL,(1),RLSE),LRECL=80,RECFM=FB,BLKSIZE=0
//*
//STEP0300  EXEC PGM=IKJEFT01,DYNAMNBR=25
//SYSTSPRT  DD   SYSOUT=*
//SYSOUT    DD   SYSOUT=*
//SORTIN    DD   *
Dummy Record
//SYSIN     DD   *
    OPTION COPY
//SYSTSIN   DD   *
  ALLOC FI(SORTOUT) +
//          DD   DISP=SHR,DSN=&&NEWDSN1
//          DD   *
  NEW LIKE('T750K.MODEL.DATA')
  CALL 'SYS1.SICELINK(ICEMAN)'
/*

Re: passing a value from file to a Symbolic

PostPosted: Tue Mar 20, 2012 6:59 pm
by mathew28
Thanks Thomas for the reply.

Hope you are combining this issue with one of my earliar queries. But this is a different issue. I don't know the value to be assigned to the Symbolic.
So, //SETLVL SET FNAME= ? is not there. The value that needs to be assigned to this Symbolic is available in the first record of my input file. I need to read it and then assign it to
the Symbolic //SETLVL SET FNAME=QC41223.
Once I get the value in the Symbolic , I can easily use it to create my output DSN.
Like
//SORTOUT DD DSN= XXXXX828.TEST.&FNAME, DISP=(NEW,CATLG,DELETE), RECFM=FB, LRECL=80.

When I tried your code, got the below Syntax error !! Is there any typo ?
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R12 - 09:19
INREC FINDREP=(IN=C'ERC.CSV',OUT=C'QC41223.CSV')
OPTION COPY
OUTREC FINDREP=(3:C'DA("XXXX828.TEST.',JP1,C'.DATA")+',80:X)
$
ICE007A 0 SYNTAX ERROR

Re: passing a value from file to a Symbolic

PostPosted: Tue Mar 20, 2012 7:41 pm
by mathew28
Hi guys.

I got a logic. Please suggest how to improve it.

1. Get the first first record from the input file and prepare the symoblic step using DFSORT INREC

INREC BUILD=(C'//SETLVL DD SET QCNAME=',1,7,80:X)

2. Create the remaining steps in a PROC. merge the file from step 1 and Proc to create a new PROC file.

3. Execute the PROC having the Symbolic to create the output file with that name.

hope it works. need to try it. Meanwhile please suggest any other ideas or improvements

Thanks in advance..

Re: passing a value from file to a Symbolic

PostPosted: Tue Mar 20, 2012 8:09 pm
by BillyBoyo
Talk to your technical people about that idea first. If the PROC library is a PDS, you run a high risk of "cooking" it at some point. PDSs are not good at multiple updates.

Re: passing a value from file to a Symbolic

PostPosted: Tue Mar 20, 2012 11:17 pm
by Frank Yaeger
When I tried your code, got the below Syntax error !! Is there any typo ?
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R12 - 09:19
INREC FINDREP=(IN=C'ERC.CSV',OUT=C'QC41223.CSV')
OPTION COPY
OUTREC FINDREP=(3:C'DA("XXXX828.TEST.',JP1,C'.DATA")+',80:X)
$
ICE007A 0 SYNTAX ERROR


No, you did NOT try his code. His code was:

  OUTREC BUILD=(3:C'DA(''T750K.TEST.',JP1,C'.DATA'') +',   
                80:X)                                     


which is valid. The code you tried is:

  OUTREC FINDREP=(3:C'DA("XXXX828.TEST.',JP1,C'.DATA")+',80:X)   


which is very different and is not using the correct syntax for the FINDREP function. That's why you got the syntax error.