Posted: Wed Oct 15, 2003 8:58 am Post subject: Record formating!
I have a input file which follows the sequence
Header ( 1 record)
data part( more than 1 records)
Footer ( 1 record)
Header ( 1 record)
data part ( more than 1 records)
Footer ( 1 record)
...and so on and so forth...
Sample of Header record ::
HY 031010021031 T44020
Here,T44020 is the name of the organization...which changes every time with new header record.
Now the Goal is to make a output file which should have all the above records but it also includes the name of the Organization in the "data part" at some position let say at column 65... and there are such many details in header record which i would like in "Data part" at some column position.
I mean to say let select a group 1 group of header,datapart & Footer. Now the data part has only amount value..rest is space...so i want to fill that space with the details like(Organization,etc) for that group...
and when next group comes the details is of second header and like this...
Is the above requirement possible by Sort./Icetool ?? Or shall I have write a code for it ?
Joined: 26 Nov 2002 Posts: 12366 Topics: 75 Location: San Jose
Posted: Wed Oct 15, 2003 9:59 am Post subject:
Rahul,
If easytrieve is available at your shop then it is very easy.Here is the sample code to get the desired results. I assumed that your input file LRECL is 80 and the header record is distinguished by 'HY' in the first 2 bytes , data record by 'DT' and the footer record by 'FT'.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed Oct 15, 2003 11:33 am Post subject:
The only way to do this kind of thing with DFSORT is to use an E15 exit with the appropriate logic to propagate the field from each header record to its "group" of data records. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 26 Nov 2002 Posts: 12366 Topics: 75 Location: San Jose
Posted: Thu Oct 16, 2003 4:37 am Post subject:
Rahul,
I am not sure where you did not find the IBM manual which explains user exits in DFSORT. You can access all DFSORT/ICETOOL right from this site. The first sticky topic in the utilities forum lists all DFSORT/ICETOOL manuals. You can also access them via the main page of mvsforums.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Thu Oct 16, 2003 9:58 am Post subject:
Rahul,
You would have to write the E15 exit yourself in either Assembler or COBOL. An E15 exit receives each SORTIN record from DFSORT, manipulates it as needed, and passes it back to DFSORT. In your case, you would have the E15 identify each Header record, save the fields you need from it, and pass it back to DFSORT unchanged. Then for each subsequent record (until the next Header), you would move the saved fields into the data record and pass the changed record back to DFSORT.
For complete information on DFSORT's exit routines (with examples), see:
I have a flat file which is having the header and footer record & another file with the detail part.
Header record ::(File 1)
HY xxxxxxxxx T44010 DRCDR1
Footer record :: (File 2)
FY xxxxxxxxx T44010 DRCDR1
Detail records :: (File 1)
12323434+99 DRCDR1 T44010
The problem is to make a combine file having header,detail and footer.
1) File 1 can have any number of header and footer. Output file involve only those header and footer..whose detail record is present.
2) Org(T44010) and Form name(DRCDR1) is unique for each header,footer & Detail record.
Is it possible by SORT ? I know how to do the same using Easytreive or Cobol.
Joined: 26 Nov 2002 Posts: 12366 Topics: 75 Location: San Jose
Posted: Mon Oct 20, 2003 5:23 am Post subject:
Rahul Bansal,
what is the max no: of records in the header file?? If they are less than 1000 then we can generate include statements and get a common file.For that we need the LRECL, RECFM position of Org(T44010) and Form name(DRCDR1).
The maximum number of records will be less than 1000.
Lrecl :: 80
Recfm :: FB
Position of ORG(Detail Record) :: 56
Postion of Form Name (Detail Record):: 33
But the position in the Header and Footer ::
Lrecl :: 80
Recfm :: FB
Position of ORG(Detail Record) :: 33
Postion of Form Name (Detail Record):: 42
Joined: 26 Nov 2002 Posts: 12366 Topics: 75 Location: San Jose
Posted: Mon Oct 20, 2003 7:58 am Post subject:
Rahul,
The following DFSORT/ICETOOL JCl will give you the desired results.A brief explanation of the JOb. If you have syncsort at your shop then change the pgm name to synctool.
The first copy operator takes in the detail record file and creates a control card for the header/footer file as follows.
Code:
INCLUDE COND=(33,6,CH,EQ,C'T44010',AND,42,6,CH,EQ,C'DRCDR1')
OUTFIL FNAMES=H1,INCLUDE=(1,2,CH,EQ,C'HY')
OUTFIL FNAMES=F1,INCLUDE=(1,2,CH,EQ,C'FY')
The above created control card is then used in second copy step to filter the header and footer records for that particular org and form into 2 different files , File H1 to to have the header record and file F1 to have the footer record.
Once we have these 2 files concat the files in this order.Header file(H1), your detailed record file and finally your Footer file(F1)
The third copy will take in these concatenated files and create one output file
Joined: 26 Nov 2002 Posts: 12366 Topics: 75 Location: San Jose
Posted: Mon Oct 20, 2003 8:00 am Post subject:
coolman,
I am not really sure if SPLICE would solve the above mentioned problem. Moreover my shop has only syncsort and they hadn't yet come up with the copy cat version of splice operator. Moreover my knowledge on SPLICE is purely theortical.I just don't wanna suggest a solution which I cannot test.
As such I prefer a standard solution to a solution involving the latest features. The latest features may or may not be available at every shop even though the features are free and can be installed very easily. But somehow the system programmers don't have time to apply all these new PTF'S.
I bet frank will show us if it is possible with SPLICE. He is on west coast and it will be another 2 hours for him to start his work.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum