How to use Header in Sort JCL

In this Mainframe Forum - You can post your queries on DFSORT, ICETOOL , SyncSort & JCL Utilities

Moderators: Frank Yaeger, Moderator Group

Post Reply
Harshal_Chaudhari
Member
Posts: 8
Joined: Tue Oct 30, 2012 5:14 pm

How to use Header in Sort JCL

Post by Harshal_Chaudhari » Tue Oct 30, 2012 5:30 pm

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.

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Tue Oct 30, 2012 5:55 pm

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.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

NicC
Active Member
Posts: 650
Joined: Sun Jul 24, 2011 5:27 pm
Location: Down on the pig farm

Post by NicC » Tue Oct 30, 2012 6:28 pm

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.
Regards
Nic

William Collins
Active Member
Posts: 732
Joined: Thu May 24, 2012 4:07 am

Post by William Collins » Tue Oct 30, 2012 7:19 pm

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).

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others