MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to check for Data Existence in a File

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
vini
Intermediate


Joined: 12 Jan 2004
Posts: 240
Topics: 48
Location: Maryland

PostPosted: Thu May 24, 2012 5:48 pm    Post subject: How to check for Data Existence in a File Reply with quote

This dataset happens to be a single row FB/LRECL 80 containing control data.

Over and above checking if the file is empty I also need to check if the file has some data, where spaces should not be considered as data.

Example:
File seemingly empty ..in the sense ....all it has is a single ROW full of only spaces.
Problem:
IDCAMS REPRO with COUNT(1) option is not flagging this as EMPTY because of presence of SPACES.
However, the requirement is to consider such data/spaces as empty as well and set the MAXCC to 12.

Anyone knows how to do this check using IDCAMS or some other utility ???
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Thu May 24, 2012 6:50 pm    Post subject: Reply with quote

vini,

Use the following DFSORT JCL which will set a return code of 4 when the file is empty after eliminating all space records

Code:

//STEP0100 EXEC PGM=SORT             
//SYSOUT   DD SYSOUT=*               
//SORTIN   DD DSN=your FB 80 control data file,DISP=SHR
//SORTOUT  DD DUMMY
//SYSIN    DD *                       
  OMIT COND=(1,80,CH,EQ,C' ')         
  OPTION COPY,STOPAFT=1,NULLOUT=RC4   
//*   

_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vini
Intermediate


Joined: 12 Jan 2004
Posts: 240
Topics: 48
Location: Maryland

PostPosted: Thu May 24, 2012 11:07 pm    Post subject: Reply with quote

Thanks Kolusu, this should do the trick .... will run this by tomorrow. 8)
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri May 25, 2012 12:19 pm    Post subject: Reply with quote

vini,

Alternatively, you can use this DFSORT/ICETOOL job.

Code:

//S1    EXEC  PGM=ICETOOL                 
//TOOLMSG DD SYSOUT=*                     
//DFSMSG  DD SYSOUT=*                     
//IN   DD DSN=...  input file         
//TOOLIN DD *                             
COUNT FROM(IN) EMPTY USING(CTL1)       
//CTL1CNTL DD *                           
  OMIT COND=(1,80,CH,EQ,C' ')             


It will pass back RC=0 or RC=12 by default. If you want RC=4 instead of RC=12, just add the RC4 operand to the COUNT operator like this


Code:

COUNT FROM(IN) EMPTY USING(CTL1) RC4

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vini
Intermediate


Joined: 12 Jan 2004
Posts: 240
Topics: 48
Location: Maryland

PostPosted: Fri May 25, 2012 1:58 pm    Post subject: Reply with quote

Kolusu,

I tried the SORT and the step is giving an RC of 0 instead of 4.

The input data was a single record of 80/FBA containing all spaces Confused
Back to top
View user's profile Send private message
papadi
Supermod


Joined: 20 Oct 2009
Posts: 594
Topics: 1

PostPosted: Fri May 25, 2012 2:34 pm    Post subject: Reply with quote

Suggest you post the jcl and control statements submitted as well as the informatonal messages generated by the run (include the message ids).

Did you notice the posted solution uses ICETOOL rather than SORT?
_________________
All the best,

di


Last edited by papadi on Fri May 25, 2012 2:35 pm; edited 1 time in total
Back to top
View user's profile Send private message
vini
Intermediate


Joined: 12 Jan 2004
Posts: 240
Topics: 48
Location: Maryland

PostPosted: Fri May 25, 2012 2:34 pm    Post subject: Reply with quote

Frank,

I tried both the suggested ways and am still getting RC of 0.
Input data was single record containing all spaces FB/80.
Back to top
View user's profile Send private message
papadi
Supermod


Joined: 20 Oct 2009
Posts: 594
Topics: 1

PostPosted: Fri May 25, 2012 2:36 pm    Post subject: Reply with quote

To repeat:

Quote:

Suggest you post the jcl and control statements submitted as well as the informatonal messages generated by the run (include the message ids).

Did you notice the posted solution uses ICETOOL rather than SORT?

_________________
All the best,

di
Back to top
View user's profile Send private message
vini
Intermediate


Joined: 12 Jan 2004
Posts: 240
Topics: 48
Location: Maryland

PostPosted: Fri May 25, 2012 3:05 pm    Post subject: Reply with quote

papadi,
Franks /solution#2 uses ICETOOL and Kolusus /solution#1 uses DFSORT.

I am using PROC which is called by the JCL so not sure if you want all of that posted

Here is the sysout ,jesmsglg & Input Data for Soln#1

Code:
ICE143I 0 BLOCKSET     COPY  TECHNIQUE SELECTED                                 
ICE250I 0 VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AN
ICE000I 1 - CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R5 - 15:39 ON FRI MAY
            OMIT COND=(1,80,CH,EQ,C' ')                                         
            OPTION COPY,STOPAFT=1,NULLOUT=RC4                                   
ICE201I E RECORD TYPE IS F - DATA STARTS IN POSITION 1                         
ICE751I 0 C5-K26318 C6-K90007 C7-K90000 C8-K23476 E9-K90007 C9-BASE   E5-K31980
ICE193I 0 ICEAM1 ENVIRONMENT IN EFFECT - ICEAM1 INSTALLATION MODULE SELECTED   
ICE088I 0 RSXHKA0D.SGXP540D.SGX40S05, INPUT LRECL = 80, BLKSIZE = 27920, TYPE =
ICE093I 0 MAIN STORAGE = (MAX,8388608,8388608)                                 
ICE156I 0 MAIN STORAGE ABOVE 16MB = (8312662,8312662)                           
ICE127I 0 OPTIONS: OVFLO=RC0 ,PAD=RC0 ,TRUNC=RC0 ,SPANINC=RC16,VLSCMP=N,SZERO=Y,
ICE128I 0 OPTIONS: SIZE=8388608,MAXLIM=2097512,MINLIM=512000,EQUALS=N,LIST=Y,ERE
ICE129I 0 OPTIONS: VIO=N,RESDNT=ALL ,SMF=SHORT,WRKSEC=Y,OUTSEC=Y,VERIFY=N,CHALT=
ICE130I 0 OPTIONS: RESALL=4096,RESINV=0,SVC=109 ,CHECK=Y,WRKREL=Y,OUTREL=Y,CKPT=


JESMSGLG where STEP 05 is the SORT
Code:

                    J E S 2  J O B  L O G  --  S Y S T E M  U N 0 F  --  N O D E
                                                                               
15.39.02 JOB05189 ---- FRIDAY,    25 MAY 2012 ----                             
15.39.02 JOB05189  ICH70001I RSXXXA   LAST ACCESS AT 15:30:38 ON FRIDAY, MAY 25,
15.39.02 JOB05189  $HASP373 RSXXXA0D STARTED - INIT 1    - CLASS B - SYS UN0F   
15.39.02 JOB05189  IEF403I RSXXXA0D - STARTED - TIME=15.39.02                   
15.39.02 JOB05189  -                                         --TIMINGS (MINS.)--
15.39.02 JOB05189  -JOBNAME  STEPNAME PROCSTEP    RC   EXCP    CPU    SRB  CLOCK
15.39.02 JOB05189  -RSXXXA0D SGXP540D SGX40S03    00     95    .00    .00    .00
15.39.03 JOB05189  -                                         --TIMINGS (MINS.)--
15.39.03 JOB05189  -JOBNAME  STEPNAME PROCSTEP    RC   EXCP    CPU    SRB  CLOCK
15.39.03 JOB05189  -RSXXXA0D SGXP540D SGX40S05    00     75    .00    .00    .00
15.39.03 JOB05189  -                                         --TIMINGS (MINS.)--
15.39.03 JOB05189  -JOBNAME  STEPNAME PROCSTEP    RC   EXCP    CPU    SRB  CLOCK
15.39.03 JOB05189  -RSXXXA0D SGXP540D SGX40S06 FLUSH      0    .00    .00    .00



Input DS
Code:
VIEW       SXXX.CHEESE.CF.COST.QTR.J540T.G0001V00         Columns 00001 00072
Command ===>                                                  Scroll ===> CSR 
****** ***************************** Top of Data ******************************
000100                                                                         
****** **************************** Bottom of Data ****************************
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri May 25, 2012 3:17 pm    Post subject: Reply with quote

what is in columns 73 thru 80?

just for grins, how about changing the OMIT from 1,80
to 1,72.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
vini
Intermediate


Joined: 12 Jan 2004
Posts: 240
Topics: 48
Location: Maryland

PostPosted: Fri May 25, 2012 3:17 pm    Post subject: Reply with quote

    Here are all the desired STEPS with brief descriptions:

    Step 03: COND=(0,LE) to bypass this step to check for empty file using the original IDCAMS

    Step 05 : Soln #1 (Check Control File for Data). IF no data / empty set RC 4.

    Step 06: Soln#2 with COND=(0,LE) to bypass

    Step 10: Check Client Detail File for Data. This is a multiple record file of LRECL 255/FB. IF no data / empty set RC 4.

    Step 15: IF ((RC.Step5= 4 and RC.Step10= 0) OR ((RC.Step5= 0 and RC.Step10= 4) THEN
    Exec IDCAMS where MAXCC is Set to 12
    ENDIF

    Step 20 to Step 50 : Exec Cobol-Db2 Pgms etc -- core process
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri May 25, 2012 3:25 pm    Post subject: Reply with quote

[REPEAT COMMENT ON]
what is in columns 73 thru 80?

just for grins, how about changing the OMIT from 1,80
to 1,72.
[REPEAT COMMENT OFF]


vini,

i really can't believe that you are so silly as to question both Frank and Kolusu.

and we don't really care about the rest of the garbage in your joh.

only the sort step, which you said you copied, properly(?)
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
vini
Intermediate


Joined: 12 Jan 2004
Posts: 240
Topics: 48
Location: Maryland

PostPosted: Fri May 25, 2012 3:28 pm    Post subject: Reply with quote

dbZ .... I was so far assuming that 73 thru 80 was empty but guess what it contains ? Shocked
Code:

VIEW       SXXX.CHEESE.CC.COST.QTR.J540T.G0001V00         Columns 00009 00080
Command ===>                                                  Scroll ===> CSR 
****** ***************************** Top of Data ******************************
000100                                                                 00000100
****** **************************** Bottom of Data ****************************


I am going to retry by removing the line number on RHS. Am sure it will work. Yes, silly me .. ofcors !!!
Mad
Back to top
View user's profile Send private message
dbzTHEdinosauer
Supermod


Joined: 20 Oct 2006
Posts: 1411
Topics: 26
Location: germany

PostPosted: Fri May 25, 2012 3:30 pm    Post subject: Reply with quote

glad you were able to resolve it.

by the way, you can avoid this problem when you edit a ds,
if you set your edit profile to NUMOFF.
_________________
Dick Brenholtz
American living in Varel, Germany
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri May 25, 2012 3:37 pm    Post subject: Reply with quote

Vini,

Yes, that was my first thought ... that you have sequence numbers in 73-80 so the record really isn't blank.

Dick,

Good catch.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group