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

Related to performing validation of file by finding blanks


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

New User


Joined: 24 Apr 2020
Posts: 10
Location: India

PostPosted: Fri Apr 24, 2020 5:44 pm
Reply with quote

Hi! I have a requirement to perform validation of a file by finding blank spaces in between the file.
The validation will be like -
The file has data and all records need to have
11,2 blank and
15,1 blank and
21,2 blank and
27,3 blank and
38,1 blank

If the validation is successful, I need to send all records on the current file as per the copybook to the requested addresses.
If the validation fails i.e. if the file will contain bad records (in any of the places that should be blank), no report/mail will be send.
Please advise how it can be done.
Thank you
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2127
Location: USA

PostPosted: Fri Apr 24, 2020 5:50 pm
Reply with quote

What exactly prevents you from doing your own job?? 36_8_9.gif
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2454
Location: Hampshire, UK

PostPosted: Fri Apr 24, 2020 7:59 pm
Reply with quote

Quote:
a file by finding blank spaces in between the file.

What exactly does this mean? I suspect you mean dataset not 'file' in the first instance and 'fields' for the second 'file'.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Fri Apr 24, 2020 8:22 pm
Reply with quote

Kumar Sandeep wrote:
Hi! I have a requirement to perform validation of a file by finding blank spaces in between the file.
The validation will be like -
The file has data and all records need to have
11,2 blank and
15,1 blank and
21,2 blank and
27,3 blank and
38,1 blank

If the validation is successful, I need to send all records on the current file as per the copybook to the requested addresses.
If the validation fails i.e. if the file will contain bad records (in any of the places that should be blank), no report/mail will be send.
Please advise how it can be done.
Thank you


Please use code tags when representing any code or data.

Easy way you can try -
1. Step#1 , Filter the records and find any one suing Include.
Code:
INCLUDE COND=("Your mentioned Conditions")

2. Step#2, Check if the Dataset is empty form Step2 and set RC=4
Code:
COUNT FROM(IN) EMPTY RC4


Use IF THEN in JCL and use the step#2 RC=4 to execute Email step.

Note : Both steps may be combined to one, but I believe you are looking for simple solution based on the requirements and not solving any performance problems.icon_smile.gif
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1329
Location: Bamberg, Germany

PostPosted: Sat Apr 25, 2020 12:10 am
Reply with quote

To not make this thread too boring..this should do what's requested.
Code:
//ISANYBAD EXEC PGM=ICEMAN         
//SORTIN   DD DISP=OLD,DSN=<input>
//SYSOUT   DD SYSOUT=*             
//SORTOUT  DD DUMMY               
//SYSIN    DD *                   
  OPTION COPY                     
  OMIT COND=(11,2,CH,EQ,C' ',AND, 
             15,1,CH,EQ,C' ',AND, 
             21,2,CH,EQ,C' ',AND, 
             27,3,CH,EQ,C' ',AND, 
             38,1,CH,EQ,C' ')     
  OUTFIL NULLOFL=RC4,ACCEPT=1     
  END                             
/*                                 
//         IF (ISANYBAD.RC=4) THEN
//SENDMAIL EXEC <whatever_is_needed_here>         
//         ENDIF
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Sat Apr 25, 2020 12:28 am
Reply with quote

Joerg.Findeisen wrote:
To not make this thread too boring..this should do what's requested.
Code:
//ISANYBAD EXEC PGM=ICEMAN         
//SORTIN   DD DISP=OLD,DSN=<input>
//SYSOUT   DD SYSOUT=*             
//SORTOUT  DD DUMMY               
//SYSIN    DD *                   
  OPTION COPY                     
  OMIT COND=(11,2,CH,EQ,C' ',AND, 
             15,1,CH,EQ,C' ',AND, 
             21,2,CH,EQ,C' ',AND, 
             27,3,CH,EQ,C' ',AND, 
             38,1,CH,EQ,C' ')     
  OUTFIL NULLOFL=RC4,ACCEPT=1     
  END                             
/*                                 
//         IF (ISANYBAD.RC=4) THEN
//SENDMAIL EXEC <whatever_is_needed_here>         
//         ENDIF


Are you sure this will work ? I don't see RC-4 is being set, if anyone record has is a bad record.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1329
Location: Bamberg, Germany

PostPosted: Sat Apr 25, 2020 12:37 am
Reply with quote

Rohit Umarjikar wrote:
Are you sure this will work ? I don't see RC-4 is being set, if anyone record has is a bad record.

I am confident it will work. I usually test before submitting to the Forum. icon_wink.gif

1) OMIT anything valid
2) OUTFIL first invalid record or RC4 if nothing invalid to be printed
3) IF / THEN on RC4
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Sat Apr 25, 2020 1:20 am
Reply with quote

Joerg.Findeisen wrote:
Rohit Umarjikar wrote:
Are you sure this will work ? I don't see RC-4 is being set, if anyone record has is a bad record.

I am confident it will work. I usually test before submitting to the Forum. icon_wink.gif

1) OMIT anything valid
2) OUTFIL first invalid record or RC4 if nothing invalid to be printed
3) IF / THEN on RC4


I tried your JCL with simple input but did not work -
Code:
//ISANYBAD EXEC PGM=ICEMAN   
//SORTIN   DD *             
123456                       
123456                       
123451
 23456                       
//SYSOUT   DD SYSOUT=*       
//SORTOUT  DD DUMMY         
//SYSIN    DD *             
  OPTION COPY               
  OMIT COND=(1,1,CH,EQ,C' ')
  OUTFIL NULLOFL=RC4,ACCEPT=1
  END                         


*********************************************************
This is what I could do in one step and works if anyone record is invalid ( contains blank) TS can now change this to actual offsets and expand include cond to its real values.

IF RC-4 then execute Email step else NO.

Code:
//S1       EXEC  PGM=ICETOOL                                         
//SYSOUT   DD  SYSOUT=*                                               
//TOOLMSG  DD  SYSOUT=*                                               
//DFSMSG   DD  SYSOUT=*                                               
//IN   DD  *                                                         
123416                                                               
122226                                                               
122416                                                               
//OUT      DD   DSN=&&T1,DISP=(,PASS),UNIT=SYSDA,SPACE=(CYL,(1,1))   
//SORTOUT  DD  SYSOUT=*                                               
//TOOLIN   DD    *                                                   
COPY FROM(IN) TO(OUT) USING(CTL1)                                     
COUNT FROM(OUT) EMPTY RC4                                             
//CTL1CNTL DD   *                                                     
  INCLUDE COND=(1,1,CH,EQ,C' ')
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1329
Location: Bamberg, Germany

PostPosted: Sat Apr 25, 2020 1:51 am
Reply with quote

Do not send if any of the input records is invalid, right?
Code:
//ISANYBAD EXEC PGM=ICEMAN                                           
//SORTIN   DD *                                                       
Valid                                                                 
this has data  on     pos    11 to 12 and makes this an invalid input
/*                                                                   
//SYSOUT   DD SYSOUT=*                                               
//SORTOUT  DD DUMMY                                                   
//SYSIN    DD *                                                       
  OPTION COPY                                                         
  OMIT COND=(11,2,CH,EQ,C' ',AND,                                     
             15,1,CH,EQ,C' ',AND,                                     
             21,2,CH,EQ,C' ',AND,                                     
             27,3,CH,EQ,C' ',AND,                                     
             38,1,CH,EQ,C' ')                                         
  OUTFIL NULLOFL=RC4,ACCEPT=1                                         
  END                                                                 
/*                                                                   
//         IF (ISANYBAD.RC=4) THEN                                   
//SENDMAIL EXEC PGM=IEFBR14                                           
//         ENDIF

This will flush the SENDMAIL step because of the second record.
Code:
STEPNAME ProcStep Pgm-Name Step-CC
ISANYBAD          ICEMAN   CC 0000
SENDMAIL          IEFBR14  FLUSH

without the invalid second record
Code:
STEPNAME ProcStep Pgm-Name Step-CC
ISANYBAD          ICEMAN   CC 0004
SENDMAIL          IEFBR14  CC 0000
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Sat Apr 25, 2020 2:35 am
Reply with quote

Joerg.Findeisen wrote:
Do not send if any of the input records is invalid, right?
Code:
//ISANYBAD EXEC PGM=ICEMAN                                           
//SORTIN   DD *                                                       
Valid                                                                 
this has data  on     pos    11 to 12 and makes this an invalid input
/*                                                                   
//SYSOUT   DD SYSOUT=*                                               
//SORTOUT  DD DUMMY                                                   
//SYSIN    DD *                                                       
  OPTION COPY                                                         
  OMIT COND=(11,2,CH,EQ,C' ',AND,                                     
             15,1,CH,EQ,C' ',AND,                                     
             21,2,CH,EQ,C' ',AND,                                     
             27,3,CH,EQ,C' ',AND,                                     
             38,1,CH,EQ,C' ')                                         
  OUTFIL NULLOFL=RC4,ACCEPT=1                                         
  END                                                                 
/*                                                                   
//         IF (ISANYBAD.RC=4) THEN                                   
//SENDMAIL EXEC PGM=IEFBR14                                           
//         ENDIF

This will flush the SENDMAIL step because of the second record.
Code:
STEPNAME ProcStep Pgm-Name Step-CC
ISANYBAD          ICEMAN   CC 0000
SENDMAIL          IEFBR14  FLUSH

without the invalid second record
Code:
STEPNAME ProcStep Pgm-Name Step-CC
ISANYBAD          ICEMAN   CC 0004
SENDMAIL          IEFBR14  CC 0000

SORTIN has both invalid records in your case. You will need keep many valid and one invalid to test.
Moreover, I have a syncsort product and I have not got RC-4 for any valid or invalid combination.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1329
Location: Bamberg, Germany

PostPosted: Sat Apr 25, 2020 3:13 am
Reply with quote

Tested with SYNCSORT now, you need to slightly edit the JCL/SYSIN here. Please be so kind and try on your site with both input records first, then delete the second.
Code:
//ISANYBAD EXEC PGM=SORT                                             
//SORTIN   DD *                                                     
Valid                                                               
this has data  on     pos    11 to 12 and makes this an invalid input
/*                                                                   
//SYSOUT   DD SYSOUT=*                                               
//SORTOUT  DD DUMMY                                                 
//ANY      DD DUMMY                                                 
//SYSIN    DD *                                                     
  OPTION COPY                                                       
  OMIT COND=(11,2,CH,EQ,C' ',AND,                                   
             15,1,CH,EQ,C' ',AND,                                   
             21,2,CH,EQ,C' ',AND,                                   
             27,3,CH,EQ,C' ',AND,                                   
             38,1,CH,EQ,C' ')                                       
  OUTFIL FNAMES=(ANY),NULLOFL=RC4,ACCEPT=1                           
  END                                                               
/*                                                                   
//         IF (ISANYBAD.RC=4) THEN                                   
//SENDMAIL EXEC PGM=IEFBR14                                         
//         ENDIF

WER169I RELEASE 2.1 BATCH 0539 TPF LEVEL 7.0
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Mon Apr 27, 2020 2:35 am
Reply with quote

FNAMES=(ANY) wouldn't make any much of a difference than before. I don't still see it is working.
Code:
//SORTIN   DD *                                                     
Valid                                                               
this has data  on     pos    11 to 12 and makes this an invalid input
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
/*

RC-0

Code:
//SORTIN   DD *                                                     
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
/*

RC-4 is expected since both records are good but your card will product RC-0.

Your card will only product RC-4 if first one is a bad record.

The requirement is if input data set has anyone bad record , anywhere then the email should not be send out else it do.

IF (ISANYBAD.RC=4) is never set for all good records , on contrary if the the input has only one record and that's bad one then RC-4 is set and email is sent when we don't want to.

**************************************************
This is what I shared earlier-
Code:
//S1       EXEC  PGM=ICETOOL                                         
//SYSOUT   DD  SYSOUT=*                                               
//TOOLMSG  DD  SYSOUT=*                                               
//DFSMSG   DD  SYSOUT=*                                               
//IN   DD  *                                                         
123416                                                               
122226                                                               
122416                                                               
//OUT      DD   DSN=&&T1,DISP=(,PASS),UNIT=SYSDA,SPACE=(CYL,(1,1))   
//SORTOUT  DD  SYSOUT=*                                               
//TOOLIN   DD    *                                                   
COPY FROM(IN) TO(OUT) USING(CTL1)                                     
COUNT FROM(OUT) EMPTY RC4                                             
//CTL1CNTL DD   *                                                     
  INCLUDE COND=(1,1,CH,EQ,C' ')


If there is any one bad record anywhere then RC-0 is set else RC-4. If RC-4 I set then in the next step email can be sent out else No
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1329
Location: Bamberg, Germany

PostPosted: Mon Apr 27, 2020 10:01 am
Reply with quote

Rohit Umarjikar wrote:
FNAMES=(ANY) wouldn't make any much of a difference than before. I don't still see it is working.
Code:
//SORTIN   DD *                                                     
Valid                                                               
this has data  on     pos    11 to 12 and makes this an invalid input
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
/*

RC-0

Code:
//SORTIN   DD *                                                     
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
/*

RC-4 is expected since both records are good but your card will product RC-0.

This is not correct! Your second sample is also expected to RC0 (=there are bad records) because both records are not valid. Look again at what the TS has written:

Kumar Sandeep wrote:
The file has data and all records need to have
11,2 blank and
15,1 blank and
21,2 blank and
27,3 blank and
38,1 blank


The only issue on my side I can see is, that when the input is empty it's considered valid.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Tue Apr 28, 2020 12:06 am
Reply with quote

You are right on this , if its blanks on those positions then its a valid else invalid. I just flipped it, my bad. what you posted should also work except for the empty file (which I don't think is a big deal for TS to fix it)

This is what I tried and should work for empty file too.
Code:

//S1       EXEC  PGM=ICETOOL                                     
//SYSOUT   DD  SYSOUT=*                                           
//TOOLMSG  DD  SYSOUT=*                                           
//DFSMSG   DD  SYSOUT=*                                           
//IN   DD  *                                                     
BBBBBBBBBB**BB*BBBBB**BBBB***BBBBBBBB*BBBBBBBBBBBBBBBBBBBBBB     
BBBBBBBBBB  BB BBBBB  BBBB   BBBBBBBB BBBBBBBBBBBBBBBBBBBBBB     
//OUT      DD   DSN=&&T1,DISP=(,PASS),UNIT=SYSDA,SPACE=(CYL,(1,1))
//SORTOUT  DD  SYSOUT=*                                           
//TOOLIN   DD    *                                               
COPY FROM(IN) TO(OUT) USING(CTL1)                                 
COUNT FROM(OUT) EMPTY RC4                                         
COUNT FROM(IN) EMPTY RC8                                         
//CTL1CNTL DD   *                                                 
  INCLUDE COND=(11,2,CH,NE,C' ',AND,                             
                15,1,CH,NE,C' ',AND,                             
                21,2,CH,NE,C' ',AND,                             
                27,3,CH,NE,C' ',AND,                             
                38,1,CH,NE,C' ')       

If the input data set is empty then RC-8
If there is even one bad record then RC-0
If all the records are good then RC-4

IF RC-4 then email can be sent.
Back to top
View user's profile Send private message
Kumar Sandeep

New User


Joined: 24 Apr 2020
Posts: 10
Location: India

PostPosted: Wed Apr 29, 2020 2:39 pm
Reply with quote

Nic Clouston wrote:
Quote:
a file by finding blank spaces in between the file.

What exactly does this mean? I suspect you mean dataset not 'file' in the first instance and 'fields' for the second 'file'.


It's a sequential file (PS). The validation should be, say for example the file is containing records as below.
AAAAA BBBBB CCCCC DDDD
There should not be any other character between 2 records (like below) and that should be blank.
AAAAA 5BBBBB CCCCC DDDD

If there will be any character in between then in that case the validation will fail.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1329
Location: Bamberg, Germany

PostPosted: Wed Apr 29, 2020 2:43 pm
Reply with quote

You have got working samples for your request. Out of curiosity, is it likely that the input will be empty sometimes?
Back to top
View user's profile Send private message
Kumar Sandeep

New User


Joined: 24 Apr 2020
Posts: 10
Location: India

PostPosted: Wed Apr 29, 2020 3:38 pm
Reply with quote

Rohit Umarjikar wrote:
You are right on this , if its blanks on those positions then its a valid else invalid. I just flipped it, my bad. what you posted should also work except for the empty file (which I don't think is a big deal for TS to fix it)

This is what I tried and should work for empty file too.
Code:

//S1       EXEC  PGM=ICETOOL                                     
//SYSOUT   DD  SYSOUT=*                                           
//TOOLMSG  DD  SYSOUT=*                                           
//DFSMSG   DD  SYSOUT=*                                           
//IN   DD  *                                                     
BBBBBBBBBB**BB*BBBBB**BBBB***BBBBBBBB*BBBBBBBBBBBBBBBBBBBBBB     
BBBBBBBBBB  BB BBBBB  BBBB   BBBBBBBB BBBBBBBBBBBBBBBBBBBBBB     
//OUT      DD   DSN=&&T1,DISP=(,PASS),UNIT=SYSDA,SPACE=(CYL,(1,1))
//SORTOUT  DD  SYSOUT=*                                           
//TOOLIN   DD    *                                               
COPY FROM(IN) TO(OUT) USING(CTL1)                                 
COUNT FROM(OUT) EMPTY RC4                                         
COUNT FROM(IN) EMPTY RC8                                         
//CTL1CNTL DD   *                                                 
  INCLUDE COND=(11,2,CH,NE,C' ',AND,                             
                15,1,CH,NE,C' ',AND,                             
                21,2,CH,NE,C' ',AND,                             
                27,3,CH,NE,C' ',AND,                             
                38,1,CH,NE,C' ')       

If the input data set is empty then RC-8
If there is even one bad record then RC-0
If all the records are good then RC-4

IF RC-4 then email can be sent.






Thank you Rohit. I hope you understood my requirement correct. I am again reposting my requirement to make it more clear and for you to provide a more accurate solution.

For example, I have a file as below:
AAAA BBBB CCCC DDDD
XXXX BBBB CCCC PPPP

The job should perform the validation that there should be blanks at below positions in this file.
11,2 blank and
15,1 blank and
21,2 blank and
27,3 blank and
38,1 blank
What it means, there should not be any other character in those positions and those should be blank.
The below file is invalid as per this check.
AAAA5BBBB CCCC DDDD
XXXX BBBB CCCC7PPPP

If the validation is successful, I need to send all records on the current file as per the copybook to the requested addresses.
If the validation fails i.e. if the file will contain bad records (in any of the places that should be blank), no report/mail will be send.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1329
Location: Bamberg, Germany

PostPosted: Wed Apr 29, 2020 4:20 pm
Reply with quote

Rohit's solution works well now. Please test yourself with sample input.
Back to top
View user's profile Send private message
Kumar Sandeep

New User


Joined: 24 Apr 2020
Posts: 10
Location: India

PostPosted: Thu Apr 30, 2020 5:38 pm
Reply with quote

Joerg.Findeisen wrote:
Rohit's solution works well now. Please test yourself with sample input.



Thank you. I will check the solution. Empty file checking I will perform in first step and validation of file, which will check for blanks in second step.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Thu Apr 30, 2020 8:16 pm
Reply with quote

Kumar Sandeep wrote:
Joerg.Findeisen wrote:
Rohit's solution works well now. Please test yourself with sample input.



Thank you. I will check the solution. Empty file checking I will perform in first step and validation of file, which will check for blanks in second step.

Please ..echo ..echo
Understand the SORT card provided, it handles empty file too and no need to add any extra steps for that. test before you come to any conclusion as directed.
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 eliminate null indicator value... DB2 7
No new posts Format Binary file to EBCDIC JCL & VSAM 4
No new posts Binary File format getting change whi... All Other Mainframe Topics 7
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Finding and researching jobs All Other Mainframe Topics 0
Search our Forums:

Back to Top