Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Need to create the headers based on some conditions

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
maxsubrat

New User


Joined: 27 Feb 2008
Posts: 78
Location: india

PostPosted: Thu Oct 28, 2010 12:45 pm    Post subject: Need to create the headers based on some conditions
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    Post subject: Reply to: Need to create the headers based on some condition
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

New User


Joined: 27 Feb 2008
Posts: 78
Location: india

PostPosted: Fri Oct 29, 2010 7:33 am    Post subject: Reply to: Need to create the headers based on some condition
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

Site Director


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

PostPosted: Fri Oct 29, 2010 8:05 am    Post subject:
Reply with quote

Hello,

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

New User


Joined: 27 Feb 2008
Posts: 78
Location: india

PostPosted: Fri Oct 29, 2010 10:53 am    Post subject: Reply to: Need to create the headers based on some condition
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

New User


Joined: 27 Feb 2008
Posts: 78
Location: india

PostPosted: Fri Oct 29, 2010 11:46 am    Post subject: Reply to: Need to create the headers based on some condition
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 Moderator


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

PostPosted: Sat Oct 30, 2010 12:03 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Create procedure issues -628 when add... chandraBE DB2 1 Mon Sep 18, 2017 12:16 pm
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts How do I create a mainframe monitorin... anjali.bisht All Other Mainframe Topics 4 Fri Sep 01, 2017 2:20 pm
This topic is locked: you cannot edit posts or make replies. rexx to create a tso command Bharath Vikraman CLIST & REXX 1 Tue Aug 08, 2017 3:32 pm
This topic is locked: you cannot edit posts or make replies. rexx code to create a ps file Bharath Vikraman CLIST & REXX 4 Mon Aug 07, 2017 10:30 am

Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us