IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Questions On Sort


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
l.nethaji

New User


Joined: 16 Mar 2008
Posts: 90
Location: tamil nadu

PostPosted: Wed Jan 06, 2010 9:28 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Jan 06, 2010 11:37 pm
Reply with quote

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
View user's profile Send private message
l.nethaji

New User


Joined: 16 Mar 2008
Posts: 90
Location: tamil nadu

PostPosted: Thu Jan 07, 2010 8:32 am
Reply with quote

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
View user's profile Send private message
l.nethaji

New User


Joined: 16 Mar 2008
Posts: 90
Location: tamil nadu

PostPosted: Thu Jan 07, 2010 8:36 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Jan 07, 2010 9:32 pm
Reply with quote

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
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Jan 07, 2010 11:22 pm
Reply with quote

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:

Code:

A0040   
B0070   
C0185   
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top