Page 1 of 1
How to use Header in Sort JCL
Posted: Tue Oct 30, 2012 5:30 pm
by Harshal_Chaudhari
Hi,
My input file is
ABC123E
EIC345D
CUC141E
OPC120U
DCB parameter as (LRECL=10,BLKSIZE=23470,RECFM=FB)
I want the Output file as,
-OPT UTILITY
-SCAN *ABC123E
-SCAN *EIC345D*
-SCAN *CUC141E*
-SCAN *OPC120U*
-END
So please can anyone help me how i will get the output file using HEADER in my SORt JCL?
Regards,
Harshal.
Posted: Tue Oct 30, 2012 5:55 pm
by dbzTHEdinosauer
HEADER in my SORt JCL?
why the need to use HEADER?
why is there no * for this item?
-SCAN *ABC123E
There is such a thing as SORT control cards,
and
there is such a thing as JCL to define a JOB that invokes SORT
but there is no such thing as SORT JCL.
why not concatenate three DS as input
one would contain:
-OPT UTILITY
the next would contain your input file
the third would contain:
-END
you SORT control cards would consist of:
COPY
an IFTHEN looking for '-' in column one,
and not finding that
would PARSE the input record ending at space
then BUILD '-SCAN *',%01,'*'
pretty simple actually.
Posted: Tue Oct 30, 2012 6:28 pm
by NicC
You would get a better result if you posted in the sort part of the forum instead of the JCL part as these are distinctly different entities. When posting in the sort section mention which sort product you are using as that section covers all mainframe sort programs. DO NOT REPOST as someone will move your original post.
Posted: Tue Oct 30, 2012 7:19 pm
by William Collins
dbz's is an approach of "utility", although the trailing "*" will not appear correctly due to the PARSED field having, of necessity, a fixed length. Certainly the "concatenation" is an approach which will work.
HEADERn and TRAILERn will also work for you, and I'm sure you should be able to find examples easily.
Getting the trailing "*" in the correct place is interesting. What is the maximum length of your data?
Let's say for now, it is 20, and assume you have FB 80 coming in (cos it looks like control cards being generated).
I'd use FINDREP, with the thing to "find" being 21 spaces, and the thing to "replace" being "*", and DO=1 and don't let is change the rest of the record (you can look that up yourself, as you'll need to understand the FINDREP anyway).
This way, you don't have to worry about embedded blanks. Your volume will be small, I assume, so minimum code to get wrong (else squeezing, PAIR=, etc).