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

Need to create the headers based on some conditions


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

Active User


Joined: 27 Feb 2008
Posts: 110
Location: india

PostPosted: Thu Oct 28, 2010 12:45 pm
Reply with quote

Hi,
I have a input file as below:

ITM-NBR DEP-ID FLAG SYS
0012 001 Y 05
0045 001 Y 09
0098 001 N 08
0034 002 Y 00
0036 002 N 07
0067 003 U 07
0067 003 N 09
0087 003 G 08
0076 003 H 08

Now my output file will be like this with the headers of each different DEP-ID with the record count of no. of records of similar DEP-ID. Below will be the output file:

OUTPUT FILE:
00103 : header record
0012 001 Y 05
0045 001 Y 09
0098 001 N 08
00202
0034 002 Y 00
0036 002 N 07
00303
0067 003 U 07
0067 003 N 09
0087 003 G 08
0076 003 H 08

00103: 001=DEP-ID,03=RECORD COUNT.

can someone help me out how to do this in DFSORT.

Thanks in advance
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu Oct 28, 2010 9:47 pm
Reply with quote

maxsubrat,

The following DFSORT JCL will give you the desired results. I assumed that your input file is FB recfm and LRECL of 80.

Code:

//STEP0100 EXEC PGM=SORT                       
//SYSOUT   DD SYSOUT=*                         
//INA      DD *                               
0012 001 Y 05                                 
0045 001 Y 09                                 
0098 001 N 08                                 
0034 002 Y 00                                 
0036 002 N 07                                 
0067 003 U 07                                 
0067 003 N 09                                 
0087 003 G 08                                 
0076 003 H 08                                 
//INB      DD *                               
0012 001 Y 05                                 
0045 001 Y 09                                 
0098 001 N 08                                 
0034 002 Y 00                                 
0036 002 N 07                                 
0067 003 U 07                                 
0067 003 N 09                                 
0087 003 G 08                                 
0076 003 H 08                                 
//SORTOUT  DD SYSOUT=*                         
//SYSIN    DD *                               
  OPTION COPY                                 
  JOINKEYS F1=INA,FIELDS=(6,3,A)               
  JOINKEYS F2=INB,FIELDS=(1,3,A)               
  JOIN UNPAIRED                               
  REFORMAT FIELDS=(F1:1,80,F2:4,3)             
  OUTFIL REMOVECC,BUILD=(1,80),               
  SECTIONS=(6,3,HEADER3=(6,3,X,81,3))         
//JNF2CNTL DD *                               
  INREC BUILD=(6,3,C'001')                     
  SUM FIELDS=(4,3,ZD)                         
//*


The output from this job is

Code:

001 003       
0012 001 Y 05 
0045 001 Y 09 
0098 001 N 08 
002 002       
0034 002 Y 00 
0036 002 N 07 
003 004       
0067 003 U 07 
0067 003 N 09 
0087 003 G 08 
0076 003 H 08 
Back to top
View user's profile Send private message
maxsubrat

Active User


Joined: 27 Feb 2008
Posts: 110
Location: india

PostPosted: Fri Oct 29, 2010 7:33 am
Reply with quote

Thanks very much for the solution.
One more thing i want to know, if the no. of records changes so no. of DEPT-ID will change(suppose the input file is more than 1000 records with 10 types of DEP-ID), will the SORT will take care in this situation?

What i want to say is we won't get the input records same in all days, we will get different in each days.
In today we may get 10 records with 3 types of DEP-IDs,
In tomorrow we may get 90 records with 5 types of DEP-IDs,
In one day we may get 1000 records with 9 types of DEP-IDs
In one day we may get 5000 records with 18 types of DEP-IDs

Input Records may vary, so the DEP-IDs will change accordingly.
So the current SORT will handle this? will it work until end of record in the input file?
Thanks in advance.
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: Fri Oct 29, 2010 8:05 am
Reply with quote

Hello,

Suggest you run some tests and see what happens. . .
Back to top
View user's profile Send private message
maxsubrat

Active User


Joined: 27 Feb 2008
Posts: 110
Location: india

PostPosted: Fri Oct 29, 2010 10:53 am
Reply with quote

I got errors while running this jcl:
ICE056A 0 SORTIN NOT DEFINED
ICE751I 0 C5-K90013 C6-K90013 C7-K90000 C8-K90013 E7-K24705
ICE052I 3 END OF DFSORT
Back to top
View user's profile Send private message
maxsubrat

Active User


Joined: 27 Feb 2008
Posts: 110
Location: india

PostPosted: Fri Oct 29, 2010 11:46 am
Reply with quote

Here is the complete set of error displaying in sysout:

ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 23:14 ON THU OCT
OPTION COPY
JOINKEYS F1=INA,FIELDS=(6,3,A)
$
ICE005A 0 STATEMENT DEFINER ERROR
JOINKEYS F2=INB,FIELDS=(1,3,A)
$
ICE005A 0 STATEMENT DEFINER ERROR
JOIN UNPAIRED
$
ICE005A 0 STATEMENT DEFINER ERROR
REFORMAT FIELDS=(F1:1,80,F2:4,3)
$
ICE005A 0 STATEMENT DEFINER ERROR
OUTFIL REMOVECC,BUILD=(1,80),
SECTIONS=(6,3,HEADER3=(6,3,X,81,3))
ICE005A 0 STATEMENT DEFINER ERROR
OUTFIL REMOVECC,BUILD=(1,80),
SECTIONS=(6,3,HEADER3=(6,3,X,81,3))
ICE056A 0 SORTIN NOT DEFINED
ICE751I 0 C5-K90013 C6-K90013 C7-K90000 C8-K90013 E7-K24705
ICE052I 3 END OF DFSORT
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: Sat Oct 30, 2010 12:03 am
Reply with quote

maxsubrat

In order to use JOINKEYS, you need z/OS DFSORT V1R5 PTF UK51706 (Nov, 2009), which you don't have. Ask your System Programmer to install it.

But note that z/OS DFSORT V1R5 and the z/OS release you are using are both out of service. You should move to z/OS 1.10, 1.11 or 1.12 with the corresponding level of DFSORT. So ask your System Programmer when you will be moving to a supported release.
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 How to load to DB2 with column level ... DB2 6
No new posts How to create a list of SAR jobs with... CA Products 3
No new posts Grouping by multiple headers DFSORT/ICETOOL 7
No new posts Db2 SQL - how to switch among differe... DB2 18
No new posts To search DB2 table based on Conditio... DB2 1
Search our Forums:

Back to Top