Page 1 of 1

File format

PostPosted: Fri Aug 21, 2009 12:14 am
by mahesh100
Hi,

I have requirement to format the file.

File Format:

HEADER RECORD
AUS,AUSTRLIA,0,1
GBP,GREAT BRITIAN,1,0
ABW,ARUBA,1,1
BRA,BRAZIL,0,0
TRAILOR RECORD

i Want the GBP as first record always and followed remaining records in ascending order.
Ascending by first three characters

HEADER RECORD
GBP,GREAT BRITIAN,1,0
ABW,ARUBA,1,1
AUS,AUSTRLIA,0,1
BRA,BRAZIL,0,0
TRAILOR

Please let me know any help on this to achive.

Thanks,
Mahesh

Re: File format

PostPosted: Fri Aug 21, 2009 1:11 am
by Frank Yaeger
You can use a DFSORT/ICETOOL job like the following to do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

//S1    EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG   DD  SYSOUT=*
//IN DD *
HEADER RECORD
AUS,AUSTRLIA,0,1
GBP,GREAT BRITIAN,1,0
ABW,ARUBA,1,1
BRA,BRAZIL,0,0
BRA,BRAZIL,0,1
TRAILOR RECORD
/*
//OUT DD SYSOUT=*
//TOOLIN   DD    *
DATASORT FROM(IN) TO(OUT) HEADER TRAILER USING(CTL1)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'1')),
    IFTHEN=(WHEN=(1,3,CH,EQ,C'GBP'),OVERLAY=(81:C'0'))
  SORT FIELDS=(81,1,CH,A,1,3,CH,A)
  OUTFIL FNAMES=OUT,BUILD=(1,80)
/*

Re: File format

PostPosted: Mon Aug 31, 2009 6:23 pm
by mahesh100
Frank,

Thanks Very Much Frank....
I was just thinking , DFSORT is one area where I need to Learn alot as things become pretty easy.
I was surpised by the power of usage of DFSORT.

Let me know for any Suggestions.. I have started with Beginners.

Thanks,
Mahe

Re: File format

PostPosted: Mon Aug 31, 2009 9:39 pm
by Frank Yaeger
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:

http://www.ibm.com/support/docview.wss? ... g3T7000080