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 Usergroups Profile Log in to check your private messages Log in
 

 

Validate and Increase the Input file number Using DFSORT

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

New User


Joined: 25 Jul 2005
Posts: 17

PostPosted: Fri Feb 13, 2009 4:36 pm    Post subject: Validate and Increase the Input file number Using DFSORT
Reply with quote

Hi,

I have requirement like this. Is this possible to do in sort?

The I/P and O/P files has LRECL of 80 and Fixed block.

Requirement:

I/P 1: --> Will always have single entry
Batch number 61

I/P 2: --> Will have more entries
Batch number 61
Batch number 62
Batch number 63
Batch number 65

O/P 1:
Batch number 65

O/P 2:
Batch number 64

So the output file 1 should have 65 i.e. latest batch number and the Output file 2 should have the missed batch number 64.

If this can be done thru sort, can you pls the code.
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: Fri Feb 13, 2009 9:37 pm    Post subject:
Reply with quote

You haven't described your situation well enough for anyone to help.

You need to tell us more about the records in input file2. What is the range for the batch numbers in those records? Is it always 61-65, or what? What is the maximum number of records in input file2? Is there only one missing batch number in input file2 or can there be many?

Give more information and maybe we can help.
Back to top
View user's profile Send private message
byearun

New User


Joined: 25 Jul 2005
Posts: 17

PostPosted: Sat Feb 14, 2009 3:51 pm    Post subject:
Reply with quote

The range of the batch number in input file 2 will differ daily. The next day the batch number can only be 0066 and 0067 (4 bytes) in I/P 2. The logic should be like this - Read the batch no. from I/P 1 and compares with batch no. I/P 2 and it should be +1. In this case it is 62, then if it has more batches like 63 and 65, it should validate and write last batch i.e.65 into the output 1. This Output 1 will become input 1 on next day batch cycle. The Missing batch 64 should be written into another ouput file which will be validated and sends a notification to users.

I think I have explained what ever you have expected. If not, pls let me know.
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: Mon Feb 16, 2009 12:01 am    Post subject:
Reply with quote

Quote:
I think I have explained what ever you have expected. If not, pls let me know.


Not really. And you didn't answer these questions:

What is the maximum number of records in input file2?

Is there only one missing batch number in input file2 or can there be many?

Quote:
Read the batch no. from I/P 1 and compares with batch no. I/P 2 and it should be +1. In this case it is 62, then if it has more batches like 63 and 65, it should validate and write last batch i.e.65 into the output 1.


If I/P record 2 batch number + 1 is equal to I/P record 1 batch number, what exactly do you want to do? Please show a couple of examples of input and output for this situation.

If I/P record 2 batch number + 1 is not equal to I/P record 1 batch number, what exactly do you want to do? Please show a couple of examples of input and output for this situation.

Quote:
it should validate and write last batch


What do you mean by "validate" here?
Back to top
View user's profile Send private message
byearun

New User


Joined: 25 Jul 2005
Posts: 17

PostPosted: Mon Feb 16, 2009 2:52 pm    Post subject:
Reply with quote

Quote:
What is the maximum number of records in input file2?


We cannot predict the exact count because this I/P 2 comes from external application and may vary.

In above example, it has 4 records i.e. batch 61, 62, 63, and 65.

The next day it can have only 2 records i.e. batch 66 & 67

Quote:
Is there only one missing batch number in input file2 or can there be many?


No, it can have more missing batches.

Quote:
If I/P record 2 batch number + 1 is equal to I/P record 1 batch number, what exactly do you want to do? Please show a couple of examples of input and output for this situation.

If I/P record 2 batch number + 1 is not equal to I/P record 1 batch number, what exactly do you want to do? Please show a couple of examples of input and output for this situation.


I/P 1 will always have a single record. For example, if it has 61, the I/P 2 should start with 62. Here the validation should be N+1 i.e. 61+1=62 which is correct and should write to O/P 1 and not equal should write to O/P 2. Since we have more records in I/P 2, it should validate the record like 62+1=63 and goes on. Whenever it doesn't find any valid record number i.e. not equal, it should write to the O/P 2.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Mon Feb 16, 2009 10:51 pm    Post subject: Reply to: Validate and Increase the Input file number Using
Reply with quote

byearun,

The following DFSORT JCL will give you the desired results
Code:

//*************************************************************
//* RUN THIS STEP ONLY ONCE WHICH WILL GENERATE THE BATCH     *
//* NUMBERS FROM 1 THRU 9999.                                 *
//*************************************************************
//RUN1TIME EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *                                               
DUMMY RECORD                                                   
//SORTOUT  DD DSN=your constant batch num file,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(1,1),RLSE)     
//SYSIN    DD *                                               
  SORT FIELDS=COPY                                             
  OUTFIL REPEAT=9999,                                         
  BUILD=(C'BATCH NUMBER',15:SEQNUM,4,ZD,80:X)                 
//*


Your job would have the following steps. I assumed that the batch number starts at postion 15 for 4 bytes
Code:

//*************************************************************
//* GET THE BEGIN BATCH NUMBER FROM YOUR FILE 1 AND CREATE    *
//* A SYMBOLIC BLIMIT WHICH WILL BE BATCH NUMBER + 1          *
//*************************************************************
//STEP0100 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *
----+----1----+----2----+----3-
BATCH NUMBER  0061                                             
//SORTOUT  DD DSN=&&S1,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)     
//SYSIN    DD *
  OPTION STOPAFT=1                                               
  SORT FIELDS=COPY                                             
  OUTREC OVERLAY=(15:+1,ADD,15,4,ZD,M11,LENGTH=4)             
  OUTFIL REMOVECC,NODETAIL,                                   
  TRAILER1=('BLIMIT,+',MAX=(15,4,ZD,M11,LENGTH=4))             
//*                                                             
//*************************************************************
//* GET THE ENDING BATCH NUMBER FROM YOUR FILE2 AND CREATE    *
//* A SYMBOLIC ELIMIT WHICH WILL BE MAX BATCH NUMBER          *
//*************************************************************
//STEP0200 EXEC PGM=SORT                                       
//SYSOUT   DD SYSOUT=*                                         
//SORTIN   DD *
----+----1----+----2----+----3-
BATCH NUMBER  0061                                             
BATCH NUMBER  0062                                             
BATCH NUMBER  0063                                             
BATCH NUMBER  0065                                             
BATCH NUMBER  0066                                             
//SORTOUT  DD DSN=&&S2,DISP=(,PASS),SPACE=(TRK,(1,1),RLSE)     
//SYSIN    DD *                                               
  SORT FIELDS=COPY                                             
  OUTFIL REMOVECC,NODETAIL,                                   
  TRAILER1=('ELIMIT,+',MAX=(15,4,ZD,M11,LENGTH=4))             
/*     
//*************************************************************
//* CONCATENATE THE FULL BATCH NUMBER FILE CREATED IN RUN1TIME*
//* (RUN THAT STEP ONLY ONCE) AND YOUR FILE2. THE SYMBOLS     *
//* BLIMIT AND ELIMIT WILL ELIMINATE THE UNNECESSARY RECORDS. *
//* ANY MATCHING BATCH NUMBER IN FILE2 WILL BE A DUPLICATE.   *
//* SO USING A SELECT OPERATOR WE PICK THE NODUPS WHICH ARE   *
//* THE MISSING BATCH NUMBERS. WE ALSO CREATE ANOTHER FILE    *
//* WITH THE MAX BATCH NUMBER WHICH WILL BE YOUR FILE1 FOR    *
//* NEXT RUN.                                                 *
//*************************************************************
//STEP0300 EXEC PGM=ICETOOL                                   
//TOOLMSG  DD SYSOUT=*                                         
//DFSMSG   DD SYSOUT=*                                         
//SYMNAMES DD DSN=&&S1,DISP=SHR                               
//         DD DSN=&&S2,DISP=SHR                               
//IN       DD DSN=your constant batch num file,
//            DISP=SHR
//         DD DSN=your file2,DISP=SHR
//OUT      DD DSN=your missing batch num file,
//            DISP=(NEW,CATLG,DELETE),
//            UNIT=SYSDA,
//            SPACE=(CYL,(1,1),RLSE)           
//CYCLE    DD DSN=your FILE1,DISP=SHR           
//TOOLIN   DD *
  SELECT FROM(IN) TO(OUT) ON(15,4,CH) -
  DISCARD(CYCLE) NODUPS USING(CTL1)
//CTL1CNTL DD *                                                       
  INCLUDE COND=(15,4,ZD,GE,BLIMIT,AND,15,4,ZD,LE,ELIMIT)               
  OUTFIL FNAMES=OUT                                                   
  OUTFIL FNAMES=CYCLE,REMOVECC,NODETAIL,                               
  TRAILER1=(C'BATCH NUMBER',15:MAX=(15,4,ZD,M11,LENGTH=4),80:X)       
//*
Back to top
View user's profile Send private message
byearun

New User


Joined: 25 Jul 2005
Posts: 17

PostPosted: Tue Feb 17, 2009 12:56 pm    Post subject:
Reply with quote

Excellent stuff Skolusu....The code worked perfectly...I have one doubt...You have mentioned that run
Quote:
//*************************************************************
//* RUN THIS STEP ONLY ONCE WHICH WILL GENERATE THE BATCH *
//* NUMBERS FROM 1 THRU 9999. *
//*************************************************************


Is there any particular reason for this?? Can't we schedule this daily??
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Tue Feb 17, 2009 1:55 pm    Post subject:
Reply with quote

Hi.

if the output from step1 is not going to change then there is no reason to rerun it daily.


Gerry
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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 11 Tue May 16, 2017 2:20 pm
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts SMTP the current generation number of... Jyothi Kulunde JCL & VSAM 4 Thu May 04, 2017 4:08 pm


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