View previous topic :: View next topic
|
Author |
Message |
diwa_thilak
Active User
Joined: 13 Jul 2006 Posts: 205 Location: At my desk
|
|
|
|
Hi all,
I have a flat file, with the following cols
1.
S.No Tax-Jan, Tax-Feb.................................Tax-Dec
I need to delete Tax-March to Tax- May cols through JCL. Is it possible ?
Do i need to do two copy of this flat file (i.e 1. Copy Tax-Jan to Tax-feb and 2. Tax-June to Tax-Dec) ?
2. I have other file which has followig cols.
S.No Tax-Jan Tax-feb Tax-Mar
Now i need to compare the above file with this above one based on the first three tax rates only. Is it possible thru JCL. Or do i have to write a cobol prog for this ?
Thanks in advance.
Regards,
Diwakar.D
--------------------------------------------------------
Nobody is perfect. I am Nobody |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
What is char length of each column?
What is RECFM?
What is LRECL? |
|
Back to top |
|
|
diwa_thilak
Active User
Joined: 13 Jul 2006 Posts: 205 Location: At my desk
|
|
|
|
Piyush,
They are FB records and type is numeric. I think we can do it using File-Aid but i am not sure about givin options to the tool.
Regards,
Diwakar.D |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
I asked you what is the char length of each column ???
Well, lets assume it is 5 each. So LRECL for ur I/p file is 65.
Quote: |
1.
S.No Tax-Jan, Tax-Feb.................................Tax-Dec
I need to delete Tax-March to Tax- May cols through JCL. Is it possible ?
Do i need to do two copy of this flat file (i.e 1. Copy Tax-Jan to Tax-feb and 2. Tax-June to Tax-Dec) ? |
Code: |
//SORTIN DD DSN=<INPUT_DSN>,
// DISP=SHR
//SORTOUT DD DSN=<OUTPUT_DSN>,
// DISP=(NEW,CATLG,DELETE)
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(1:1,15,16:31,35)
/* |
Quote: |
2. I have other file which has followig cols.
S.No Tax-Jan Tax-feb Tax-Mar
Now i need to compare the above file with this above one based on the first three tax rates only |
What you want to do after comparison....
Check out this DFSORT trick for the complete code.... |
|
Back to top |
|
|
diwa_thilak
Active User
Joined: 13 Jul 2006 Posts: 205 Location: At my desk
|
|
|
|
Hi,
I need to write the records in seperate dataset which have changes in Tax-Jan to Tax-Mar in File2 when compared to File-1.
Thanks,
Diwakar.D |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Check out the link posted in my earlier reply.
It'll tell you what exactly you are looking for. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Diwakar.D,
You can do this kind of thing with DFSORT. But if you want a detailed solution, you have to supply complete details of what you want to do. Show an example of the records in your input file(s) and what you want for output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input file(s). Explain clearly what you want. |
|
Back to top |
|
|
diwa_thilak
Active User
Joined: 13 Jul 2006 Posts: 205 Location: At my desk
|
|
|
|
HI,
Two Flat Files need to be compared.
File - 1.
S.No Tax-JAN ........................................TAX-DEC
All are 9(5) and the type is FB.
File - 2.
S.No TAX-JAN TAX-MAR.
there will be changes for TAX in file-2.
I need to get the records which are modified in the second file.
Regards,
Diwakar |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
If you can't do a better job of describing what you want (including an example of the input records and the output records as I requested), then I can't help you. |
|
Back to top |
|
|
diwa_thilak
Active User
Joined: 13 Jul 2006 Posts: 205 Location: At my desk
|
|
|
|
Frank,
File -1
SNO TX-01 TX-02 TX-03
00001 00245 00345 00890
00002 00345 00890 00678
File - 2
00001 00345 00345 00567 00989 .................... 00123 For 12 months.
00002 00345 00890 00678 00567 ---------------- 00777
Note that the tax for Tx01 in file 1 and file 2 is different. I need to extract the records from File-02 and i need to put the same in file03.
Record Formats:
File 01:
LRECL : 20
RECFM : FB
File 02:
LRECL : 65
RECFM : FB
Hope this information is enough.
Thanks,
Diwakar
[/b] |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
If I understand what you want (and I'm not sure I do), this DFSORT/ICETOOL job will do it:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=... input file1 (FB/20)
//IN2 DD DSN=... input file2 (FB/65)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=... output file (FB/65)
//TOOLIN DD *
* IN1->T1: reformat records to:
* |key|blanks...|IN1 data|
COPY FROM(IN1) TO(T1) USING(CTL1)
* IN2->T1: reformat records to:
* |key|IN2 data|blanks...|
COPY FROM(IN2) TO(T1) USING(CTL2)
* T1->OUT: Splice records to get:
* |key|IN2 data|IN1 data|
* If IN2 data is not equal to IN1 data, keep
* |key|IN2 data|
SPLICE FROM(T1) TO(OUT) ON(1,5,CH) WITH(1,65) USING(CTL3)
/*
//CTL1CNTL DD *
INREC BUILD=(1,5,66:6,15)
/*
//CTL2CNTL DD *
INREC OVERLAY=(80:X)
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,INCLUDE=(6,15,CH,NE,66,15,CH),
BUILD=(1,65)
/*
|
|
|
Back to top |
|
|
diwa_thilak
Active User
Joined: 13 Jul 2006 Posts: 205 Location: At my desk
|
|
|
|
Thanks Frank ,
Can you explain the significance of these steps..
Quote: |
//CTL1CNTL DD *
INREC BUILD=(1,5,66:6,15)
/*
//CTL2CNTL DD *
INREC OVERLAY=(80:X)
/*
//CTL3CNTL DD *
OUTFIL FNAMES=OUT,INCLUDE=(6,15,CH,NE,66,15,CH),
BUILD=(1,65)
|
i could not understand the significance of specifying 80:X and the INREC in CTL.
Thanks in advance.
Regards,
Diwakar.D
Nobody is Perfect. I am Nobody[/quote] |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
I added comments to my job to explain what I'm doing.
Quote: |
INREC BUILD=(1,5,66:6,15) |
Builds an output record with IN1 input positions 1-5 in ouput positions 1-5 and IN1 input positions 6-20 in output positions 66-80.
Quote: |
INREC OVERLAY=(80:X) |
Since the T1 records created from IN1 are 80 bytes, the T1 records created from IN2 must also be 80 bytes. OVERLAY with 80:X just pads the 65 byte IN2 records with blanks up to and including position 80.
Quote: |
OUTFIL FNAMES=OUT,INCLUDE=(6,15,CH,NE,66,15,CH),
BUILD=(1,65) |
Includes records where positions 6-20 (from the IN2 record) are not equal to position 66-80 (from the IN1 record) and just keeps positions 1-65 (from the IN2 record). |
|
Back to top |
|
|
|