You are on page 1of 2

If you want to append that hardcoded date after the end of each 668 record, you

can use these DFSORT statements:


Code:
SORT FIELDS=COPY
OUTREC OVERLAY=(669:C'2008-08-18')
************************************************
You can try this,
SORT FIELDS=COPY
OUTREC FIELDS=(1,668,669:C'2008-08-18')
The output dataset should have LRECL=678
******************************************
Re: sort outrec - need to set a flag

The correct syntax for setting a specific location to a 1-byte literal


is:
c:C'x' or c:X'hh'
c: is the location. You can omit it if the literal should be placed at
the next location. C'x' is a 1-byte character literal. X'hh' is a
1-byte hexadecimal literal.
c:C'x...x' or c:X'hh...hh' can be used for multibyte literals.
So as an example, you could have:
OUTREC FIELDS=(43:30,7,C'A',X'05',70:C'E7',75:X'ABCDEF')
With DFSORT, you can also just overlay a particular location with a
literal like this without changing the rest of the record:
OUTREC OVERLAY=(27:C'A')
Note that you can access all of the DFSORT books online at:
www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
Frank Yaeger - DFSORT Team (IBM) - yaeger@xxxxxxxxxx
Specialties: ICETOOL, IFTHEN, OVERLAY, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort/

********************************************************************
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1,92,C'80',93,10)
(This is simple. What this means is that you want your output file to show only
the
first 92 bytes of the input file (i.e. position 1 to 92), and then followed by a
hard
coded 80 (you are telling it to put a 2 byte character there which is 80), and t
hen
followed by the next 10 bytes of your input file (i.e. you are telling it to the
n copy
to the output file whatever is in position 93 of the input file, for 10 bytes).
The outrec
example is simple once you use it a few times. Basically you are just identifyi
ng what
field on the input to be included on the output, and its called the outrec para
meter.
*****************************************************
I have a file which has a field containing values ranging from (1-7).
Depending on these values I have to Overlay(Overwrite) that field in the O/P fil
e with (SYSDATE-n) where n is the value of that field in the I/P file.
The O/P will have the date in the format CCYY-MM-DD.
//S01 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
1
2
3
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC IFTHEN=(WHEN=(1,1,CH,EQ,C'1'),
OVERLAY=(1:DATE1(-)-1)),
IFTHEN=(WHEN=(1,1,CH,EQ,C'2'),
OVERLAY=(1:DATE1(-)-2)),
IFTHEN=(WHEN=(1,1,CH,EQ,C'3'),
OVERLAY=(1:DATE1(-)-3))
/*

You might also like