View previous topic :: View next topic
|
Author |
Message |
l.nethaji
New User
Joined: 16 Mar 2008 Posts: 90 Location: tamil nadu
|
|
|
|
1)we have a master file and sold file .
At the end of the day if a product B has 100 in master file and if it has 10 Product B sold out in the sold file .then if a run a JCL program the master file must Have 90 in it . similarly we have other products like A,C
Code: |
Master File
A 100
B 100
C 200
Sold File
A 10
A 20
B 10
A 30
B 20
C 15
|
Can anyone help in the logic how it can done using simple sort or DF sort.
L.Nethaji |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
What is the RECFM and LRECL of the Sold File and Master File?
What is the starting position, length and format of each field in each file?
Please show what you expect the output file to look like for your input example. Please use ubb code tags around your examples. |
|
Back to top |
|
|
l.nethaji
New User
Joined: 16 Mar 2008 Posts: 90 Location: tamil nadu
|
|
|
|
Hi,
The Format for both is fixed and record length 80.
Product NAme is declared as x(1) and the product count is declared as 9(4) on both the master and sold file.I just want the logic.If u have any similar examples for suming the values based on the fields please send me the JCL.
Thanks for the reply,
L.Nethaji |
|
Back to top |
|
|
l.nethaji
New User
Joined: 16 Mar 2008 Posts: 90 Location: tamil nadu
|
|
|
|
Hi,
I missed the position in the last reply.
In master file
1st position is the product name declared as x(1). .
next 4 postion is the product count 9(4).
next 75 is the product description declared x(75)
In sold file
1st position is the product name declared as x(1) .
next 4 postion is the product count .as 9(4).
next 75 is the product description declared x(75).
Thanks,
L.Nethaji |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
Please show what you expect the output file to look like for your input example. Please use ubb code tags around your examples |
Now, you need to provide this. . .
Showing the data. . . |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Nethaji,
You can use a DFSORT/ICETOOL job like the following to do what you asked for:
Code: |
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD *
A0100
B0100
C0200
//IN2 DD *
A0010
A0020
B0010
A0030
B0020
C0015
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD SYSOUT=*
//TOOLIN DD *
COPY FROM(IN1) TO(T1)
COPY FROM(IN2) TO(T1) USING(CTL1)
SORT FROM(T1) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
INREC OVERLAY=(2:2,4,ZD,MUL,-1,TO=ZD,LENGTH=4)
/*
//CTL2CNTL DD *
OPTION ZDPRINT
SORT FIELDS=(1,1,CH,A)
SUM FIELDS=(2,4,ZD)
/*
|
OUT would have:
|
|
Back to top |
|
|
|