|
View previous topic :: View next topic
|
| Author |
Message |
notonly4u
New User
.jpg)
Joined: 26 Apr 2005 Posts: 87 Location: Hyderabad
|
|
|
|
Hello one and all,
Iam having an requirement as follows
I have a plan code and a sscode lets say plan is 540 and sscode varies from S1 thru S4 like this for each plan there are only 4 sscode that
is S1 thru S4. Plan are 24. So I must split the input file into 96 files for each plan and sscode.
Now before writing any record into these files I should wirte a header record consisting of following fields Plan code, sscode,sum of records of that particula combination), total number of four sscode for that plan. I hope you got it
Now my requirement here is to first count the number of record for a plan and its related sscode. in next step I should count total records for a plan with all sscodes added.
For Eg
Lets say for a plan 540 and sscode S1 i have 100 records Similarly for the same plan and S2 I have 200 record and for same plan and S3 I have 150 recs and for same plan and S4 I have 200 recs
fist thing I should count how many records are there for under S1+540 and so forth for all 4 combinations then again combine all 4 counts and again count total number of records. Then finally update the files.
I hope you got my requirement
Pls let me know if you can find a solution for this using Sort. for inital counts atleast. Then I will go for a cobol program for updating the records.
Thanks and Regards
Tanden |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
| Please show sample input and output with relevent fields and indicate the position, length and format of the relevent fields. Also, what is the RECFM and LRECL of the input file. |
|
| Back to top |
|
 |
notonly4u
New User
.jpg)
Joined: 26 Apr 2005 Posts: 87 Location: Hyderabad
|
|
|
|
Dear Frank,
Thanks for Responding. Please find the details as below:
my input file has
position 1, length 3, - plan code
position 4, length 2 - sscode
LRECL is 1000
There were about 2000 recs
Input file
900S1.....0001000.....
900S1....3431000...
900S2....0000000...
900S3....000000...
900S4....000000...
900S4....000000...
901S1....00000....
901S2....00000
902S3....00000
OUTPUT FILE should contain the following
The fields are:
Plan code, sscode, number of recs per sscode in the plan, total number of recs(s1+s2+s3+s4 per plan)
900, S1, 2, 6
900, S2, 1, 6
900, S3, 1, 6
900, S4, 2, 6
901, S1, 1, 2
901, S2, 1, 2
902, S3, 1, 1
Hope I am clear.
Thanks and Regards
Tanden |
|
| Back to top |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Tanden,
Here's a DFSORT/ICETOOL job that will do what you asked for:
| Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file (FB/1000)
//*** Use MOD for T1
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=... output file (FB/1000)
//TOOLIN DD *
* IN->T1: Get plan count records as follows:
* pln pc
COPY FROM(IN) USING(CTL1)
* IN->T1: Get sscode count records as follows:
* pln, ss,sc,
COPY FROM(IN) USING(CTL2)
* SPLICE plan count records with sscode count records to get:
* pln, ss,sc,pc
SPLICE FROM(T1) TO(OUT) ON(1,3,CH) WITHALL WITH(1,11)
/*
//CTL1CNTL DD *
OUTFIL FNAMES=T1,REMOVECC,NODETAIL,
SECTIONS=(1,3,TRAILER3=(1,3,12:COUNT=(M10,LENGTH=2)))
/*
//CTL2CNTL DD *
OUTFIL FNAMES=T1,REMOVECC,NODETAIL,
SECTIONS=(1,5,TRAILER3=(1,3,C', ',4,2,C',',
9:COUNT=(M10,LENGTH=2),C',',13:X))
/*
|
OUT will have:
| Code: |
900, S1, 2, 6
900, S2, 1, 6
900, S3, 1, 6
900, S4, 2, 6
901, S1, 1, 2
901, S2, 1, 2
902, S3, 1, 1
|
|
|
| Back to top |
|
 |
notonly4u
New User
.jpg)
Joined: 26 Apr 2005 Posts: 87 Location: Hyderabad
|
|
|
|
Thank you verymuch for the answer Frank.
It is of much help.
Regards
Tanden. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|