|
View previous topic :: View next topic
|
| Author |
Message |
Christy
New User
Joined: 17 Nov 2010 Posts: 14 Location: India
|
|
|
|
I have an input file which looks like the following:
0001000120100010000400000000000000000000000000
0001000220100010000400000000000000000000000000
0001000320100010000400000000000140000001905215
0001000420100010000400000000000700000000000898
0001000520100010000400000000000430000000000792
0001000620100010000400000000000000000000000000
0001000720100010000400000000000000000000000000
The input file format is as follows:
Field Start Length Type
OUT-DEPT 1 4 Num
OUT-LOC 5 4 Num
OUT-YR-I 9 4 Num
OUT-MO-I 13 4 Num
OUT-MO-WK-I 17 4 Num
OUT-SUM-CMTD 21 13 Num
OUT-SUM-CYTD 34 13 Num
I want the output file in the following format:
"PURCHASES","0001","0001","2010","0010","0004","0","0"
"PURCHASES","0001","0002","2010","0010","0004","0","0"
"PURCHASES","0001","0003","2010","0010","0004","0.14","19052.15"
"PURCHASES","0001","0004","2010","0010","0004","0.70","8.98"
"PURCHASES","0001","0005","2010","0010","0004","0.43","7.92"
"PURCHASES","0001","0006","2010","0010","0004","0","0"
"PURCHASES","0001","0007","2010","0010","0004","0","0"
PURCHASES is to be added into the output file.
The quotes are been able to be inserted with Squeeze parameter but the last two fields i am not able to get.
The last two fields are numeric which has length 13.
In the output file it should be in the format 9(11)v9(2).
If the data is 0000000000000 then output file should contain "0".
If the data is 0000000000022 then output file should contain "0.22".
If the data is 0000000010022 then output file should contain "100.22".
If the data is 0000000010000 then output file should contain "100" because here the data is 100.00.
For the starting fields the control card i used for the job is below:
//SYSIN DD *
OPTION COPY
OUTREC FIELDS=(1:1,17,SQZ=(SHIFT=LEFT,LE
18:5,7,SQZ=(SHIFT=LEFT,LEAD=C'","'),
25:9,7,SQZ=(SHIFT=LEFT,LEAD=C'","'),
32:13,7,SQZ=(SHIFT=LEFT,LEAD=C'","'),
39:18,7,SQZ=(SHIFT=LEFT,LEAD=C'","'),
46:23,16,ZD,SQZ=(SHIFT=LEFT,LEAD=C'","'))
/*
Please can you help me to get the output file in the above specified format? |
|
| Back to top |
|
 |
Christy
New User
Joined: 17 Nov 2010 Posts: 14 Location: India
|
|
|
|
There is a correction in the sort card:
//SYSIN DD *
OPTION COPY
OUTREC FIELDS=(1:1,17,SQZ=(SHIFT=LEFT,LE
18:5,7,SQZ=(SHIFT=LEFT,LEAD=C'","'),
25:9,7,SQZ=(SHIFT=LEFT,LEAD=C'","'),
32:13,7,SQZ=(SHIFT=LEFT,LEAD=C'","'),
39:18,7,SQZ=(SHIFT=LEFT,LEAD=C'","'),
46:23,16,SQZ=(SHIFT=LEFT,LEAD=C'","'))
/*
And the output i obtained is as follows:
"PURCHASES","0001","0001","2010","0010","0040","0000000000000
"PURCHASES","0001","0002","2010","0010","0040","0000000000000
"PURCHASES","0001","0003","2010","0010","0040","0000000001400
"PURCHASES","0001","0004","2010","0010","0040","0000000007000
"PURCHASES","0001","0005","2010","0010","0040","0000000004300
"PURCHASES","0001","0006","2010","0010","0040","0000000000000
"PURCHASES","0001","0007","2010","0010","0040","0000000000000
Looking forward for the answer and sorry for the correction.
Thank you. |
|
| Back to top |
|
 |
nelson.pandian
Active User
.jpg)
Joined: 09 Apr 2008 Posts: 133 Location: Phoenix, AZ
|
|
|
|
Hi Christy,
Below DFSORT JCL will give you desire output. Assumed RECFM=FB & LRECL=80. Attributes can be change accordingly.
| Code: |
//STEP10 EXEC PGM=ICEMAN
//*
//SYSOUT DD SYSOUT=*
//SYMNAMES DD *
PAD,'","'
QUT,'"'
/*
//*
//SORTIN DD *
----+----1----+----2----+----3----+----4----+----5----+----6----+---
0001000120100010000400000000000000000000000000
0001000220100010000400000000000000000000000000
0001000320100010000400000000000140000001905215
0001000420100010000400000000000700000000000898
0001000520100010000400000000000430000000000792
0001000620100010000400000000000000000000000000
0001000720100010000400000000000000000000000000
/*
//*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,
BUILD=(1:C'"PURCHASES',PAD,14:1,4,PAD,21:5,4,PAD,28:9,4,PAD,
35:13,4,PAD,42:17,4,PAD,
49:21,13,UFF,EDIT=(IIIIIIIIIIT.TT),PAD,
66:34,13,UFF,EDIT=(IIIIIIIIIIT.TT),QUT)),
IFTHEN=(WHEN=(60,3,CH,EQ,C'.00'),
OVERLAY=(60:3X),HIT=NEXT),
IFTHEN=(WHEN=(77,3,CH,EQ,C'.00'),
OVERLAY=(77:3X))
OUTREC BUILD=(1,80,SQZ=(SHIFT=LEFT,PREBLANK=C' '))
/* |
OUTPUT:
| Code: |
"PURCHASES","0001","0001","2010","0010","0004","0","0"
"PURCHASES","0001","0002","2010","0010","0004","0","0"
"PURCHASES","0001","0003","2010","0010","0004","0.14","19052.15"
"PURCHASES","0001","0004","2010","0010","0004","0.70","8.98"
"PURCHASES","0001","0005","2010","0010","0004","0.43","7.92"
"PURCHASES","0001","0006","2010","0010","0004","0","0"
"PURCHASES","0001","0007","2010","0010","0004","0","0" |
|
|
| Back to top |
|
 |
Christy
New User
Joined: 17 Nov 2010 Posts: 14 Location: India
|
|
|
|
Hi,
Thank you very much.
But i would like to know what PAD,QUT and UFF stands for and please could you explain those.
Thanks,
Christy. |
|
| Back to top |
|
 |
sriram.mukundan
New User
Joined: 20 Nov 2007 Posts: 28 Location: chennai
|
|
|
|
Thanks for the information nelson.
PAD and QUT are assigned with the value '","' and '"' respectively in the SYMNAMES DD statement.
It is symbolic representation.
Instead of Hardcoding in the INREC field, he used symbolic representation.
UFF- Free Form (Unsigned Numeric)
-Regards
Sriram Mukundan |
|
| Back to top |
|
 |
Christy
New User
Joined: 17 Nov 2010 Posts: 14 Location: India
|
|
|
|
Hi,
Thank you very much.
It helped me alot to understand more.
Thanks nad Regards,
Christy |
|
| Back to top |
|
 |
Christy
New User
Joined: 17 Nov 2010 Posts: 14 Location: India
|
|
|
|
Hi,
One of the members send me this code too.
It worked as well.
| Code: |
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,
OVERLAY=(81:21,13,ZD,EDIT=(IIIIIIIIIIT.TT),C'","',
34,13,ZD,EDIT=(IIIIIIIIIIT.TT),C'"')),
IFTHEN=(WHEN=(21,13,ZD,EQ,0),OVERLAY=(91:C' 0'),HIT=NEXT),
IFTHEN=(WHEN=(34,13,ZD,EQ,0),OVERLAY=(108:C' 0'))
OUTREC BUILD=(C'"PURCHASE","',01,4,C'","',05,4,C'","',
09,4,C'","',13,4,C'","',17,4,C'","',
81,32,SQZ=(SHIFT=LEFT))
/*
|
Thanks to all.
Regards,
Christy |
|
| Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
Christy,
Thanks for posting
Learn to use "Code" tags while posting run JCL/sort card/sample data to make it rather readable. |
|
| Back to top |
|
 |
Christy
New User
Joined: 17 Nov 2010 Posts: 14 Location: India
|
|
|
|
Sure,
The above code reformatted below.
| Code: |
//SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=INIT,
OVERLAY=(81:21,13,ZD,EDIT=(IIIIIIIIIIT.TT),C'","',
34,13,ZD,EDIT=(IIIIIIIIIIT.TT),C'"')),
IFTHEN=(WHEN=(21,13,ZD,EQ,0),OVERLAY=(91:C' 0'),HIT=NEXT),
IFTHEN=(WHEN=(34,13,ZD,EQ,0),OVERLAY=(108:C' 0'))
OUTREC BUILD=(C'"PURCHASE","',01,4,C'","',05,4,C'","',
09,4,C'","',13,4,C'","',17,4,C'","',
81,32,SQZ=(SHIFT=LEFT))
/* |
Thanks for that too.
Regards,
Christy |
|
| Back to top |
|
 |
Christy
New User
Joined: 17 Nov 2010 Posts: 14 Location: India
|
|
|
|
| Thanks for everyones help. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|