Page 1 of 1

Copy rest of the records

PostPosted: Wed Apr 03, 2013 4:15 pm
by deva_048
In jcl if column (1,3,ch,eq,c'ram') then we need to copy from ram to end of records in input file
E.g)
input dataset
aaaaa
bbbbbbbbbbbbbbbbbbb
ram
cccccccccccccccc
.......
.......

o/p should be in new dataset
ram
cccccccccccccccc
.......
.......


Please advice

Re: Copy rest of the records

PostPosted: Wed Apr 03, 2013 4:29 pm
by BillyBoyo
I have assumed you records are FB and 80 bytes long.

If you are one who likes to learn, add this into your JCL (say, before SYSIN):

//SYMNAMES DD *
INPUT-RECORD,1,80,CH
EXTEND-FOR-INCLUDE-VALUE,*,3,CH
TEXT-TO-CHECK,1,=,=
TEXT-FOR-COPY-TO-END,C'ram'
//SYMNOUT DD SYSOUT=*


Use these as your control cards:

  OPTION COPY
  INREC IFTHEN=(WHEN=GROUP,
                 BEGIN=(TEXT-TO-CHECK,
                       EQ,
                        TEXT-FOR-COPY-TO-END),
                 PUSH=(EXTEND-FOR-INCLUDE-VALUE:
                       TEXT-TO-CHECK))

  OUTFIL INCLUDE=(EXTEND-FOR-INCLUDE-VALUE,
                 EQ,
                  TEXT-FOR-COPY-TO-END)


If you just want a solution, try this:

  OPTION COPY
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'ram'),
                 PUSH=(81:1,3))
  OUTFIL INCLUDE=(81,3,CH,EQ,C'ram')

Re: Copy rest of the records

PostPosted: Wed Apr 03, 2013 5:22 pm
by deva_048
Thanks billy...It works like a charm ... Thanks a lot for your help.... but minor syntax error next TEXT-TO-CHECK , missed in control card.

Re: Copy rest of the records

PostPosted: Wed Apr 03, 2013 5:36 pm
by NicC
In jcl if column (1,3,ch,eq,c'ram')

If columns 1-3 are 'ram' then it is NOT JCL - it is data. Column 1 of JCL always has '/' and column 2 is usually '/' but can be '*'.

Re: Copy rest of the records

PostPosted: Wed Apr 03, 2013 5:52 pm
by BillyBoyo
deva_048 wrote:Thanks billy...It works like a charm ... Thanks a lot for your help.... but minor syntax error next TEXT-TO-CHECK , missed in control card.


Thanks for the feedback, fixed now in original.

I hope that you understand the use of the symbols, they can make Sort Control Cards much easier to code and understand.

EDIT:

I missed one on the OUTFIL. Update that on yours, the results will be the same.