Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Complex DFSORT solution

122 views
Skip to first unread message

junea...@gmail.com

unread,
Jul 1, 2015, 5:48:19 PM7/1/15
to
I have a comma-delimited file that I need to convert to a fixed-length positional file.
Within that file I have a ZM/ZD/YYYY birth date that needs to be converted to MM/DD/YYYY in the output (inserting 01/01/0001 if the input date is blank), and a Country field that I want to exclude if the input is not equal to either 'USA' or spaces.

I am currently doing this in a COBOL program and then use SORT to sort the file and remove duplicates. However, I currently have to put the input file into Excel and manually manipulate the date to force the ten-digit output. I noted the more recent (this is an old program) advances of DFSORT and thought I could do it all with DFSORT, but I cannot seem to get the date edit to work.

I have tried both Y4W and MD4, both of which I have seen used in literature, but I keep getting syntax errors.

Any insight or assistance would be much appreciated.
Thank you.

Sri h Kolusu

unread,
Jul 1, 2015, 6:33:33 PM7/1/15
to
For some reason this topic did not show up in my mail box but is available
here

https://groups.google.com/d/msg/bit.listserv.ibm-main/p4tGxAcXyPQ/uyoz0k7_y4oJ

June,

DFSORT can definitely convert the comma delimited file into a fixed length
file. As for the conversion of the dates and padding you need to have a
second parse to get the values from ZM/ZD/YYYY birth date that needs to be
converted to MM/DD/YYYY .

Send me a sample of your input and desired output as text files to our
hotline at dfs...@us.ibm.com or send it to me directly and I will show you
a way to do it.

Thanks,
Kolusu
DFSORT Development
IBM Corporation

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to list...@listserv.ua.edu with the message: INFO IBM-MAIN

Ed Finnell

unread,
Jul 1, 2015, 7:23:13 PM7/1/15
to
Google Ibm-main is a one way gate from Ibm-main UA listserv. Evidently
there was a hole in UUNET that
let some stuff in before it could be tagged by listserv. So the two way
path was shuttered. Don't know if it's been looked at in a while


In a message dated 7/1/2015 5:33:32 P.M. Central Daylight Time,
sko...@US.IBM.COM writes:

For some reason this topic did not show up in my mail box but is available
here


Tony's Outlook via Mozilla

unread,
Jul 1, 2015, 8:10:39 PM7/1/15
to
I have converted delimited files into nice mainframe centric fixed
position datasets. Here's an skeleton of an example of taking a file
that came from EXCEL as TXT tab delimited and became a friendly dataset.
In this case I wanted each field to be 30 bytes just for my visual ease
but each field can be whatever you think its max length might be.

//SORTIN DD *
SORT FIELDS=COPY
OUTFIL PARSE=(%01=(ENDBEFR=X'05',FIXLEN=30), COL.A
%02=(ENDBEFR=X'05',FIXLEN=30), COL.B
%03=(ENDBEFR=X'05',FIXLEN=30), COL.C
%04=(ENDBEFR=X'05',FIXLEN=30), COL.D
%05=(ENDBEFR=X'05',FIXLEN=30)), COL.E
BUILD=(%01,5X,%02,5X,%03,5X,%04,5X,%05)

LRECL will be sum of (30x5) + 20 blanks.

The dates manipulation I have to defer to Sri.

junea...@gmail.com

unread,
Jul 2, 2015, 1:50:28 PM7/2/15
to
Sri Kolusu contacted me and provided the following solution (see below). It worked wonderfully converting and editing a file that had well over 600,000 rows in only .38 CPU/1.6 clock minutes.

//*******************************************************************
//* CREATE A FIXED LENGTH FILE FROM CSV INPUT FILE *
//*******************************************************************
//STEP0200 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SYMNAMES DD *
CYEAR,S'&LYR4'
//SYMNOUT DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=&&IN
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC PARSE=(%01=(ENDBEFR=C',',FIXLEN=12), $ FNAME
%02=(ENDBEFR=C',',FIXLEN=20), $ LNAME
%03=(ENDBEFR=C',',FIXLEN=09), $ SSN
%04=(ENDBEFR=C',',FIXLEN=10), $ BIRTH-DATE
%05=(ENDBEFR=C',',FIXLEN=11), $ UNIQUE#
%06=(ENDBEFR=C',',FIXLEN=40), $ ADDRESS1
%07=(ENDBEFR=C',',FIXLEN=40), $ ADDRESS2
%08=(ENDBEFR=C',',FIXLEN=30), $ CITY
%09=(ENDBEFR=C',',FIXLEN=02), $ STATE
%10=(ENDBEFR=C',',FIXLEN=05), $ ZIP5
%11=(ENDBEFR=C',',FIXLEN=04), $ ZIP4
%12=(ENDBEFR=C',',FIXLEN=10)), $ COUNTRY

BUILD=(%05, $ UNIQUE#
%02, $ LNAME
%01, $ FNAME
X, $ MI
%06, $ ADDRESS1
%07, $ ADDRESS2
%08, $ CITY
%09, $ STATE
%10, $ ZIP5
%11, $ ZIP4
%03, $ SSN
%04, $ BIRTHDATE
%12) $ COUNTRY

SORT FIELDS=(001,11,CH,A, $ UNIQUE#
166,09,CH,A) $ SSN

SUM FIELDS=NONE

OUTREC PARSE=(%13=(ABSPOS=175,ENDBEFR=C'/',FIXLEN=2), $ MM
%14=(ENDBEFR=C'/',FIXLEN=2), $ DD
%15=(FIXLEN=4)), $ CCYY
OVERLAY=(175:%13,UFF,EDIT=(TT), $ MM
C'/', $ SLASH
%14,UFF,EDIT=(TT), $ DD
C'/', $ SLASH
%15,UFF,EDIT=(TTTT), $ CCYY
175:175,10, $ CHECK
CHANGE=(10,C'00/00/0000', $ NODATE
C'01/01/0001'), $ DEF-DATE
NOMATCH=(175,10))

OUTFIL OMIT=(185,10,CH,NE,C'USA',OR,
166,08,UFF,EQ,0),
BUILD=(CYEAR,1,184)
//*

Thank you so much for the assistance.
Have a wonderful holiday weekend.
0 new messages