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
 

 

check for empty records in multiple files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
radhakrishnan82

Active User


Joined: 31 Mar 2005
Posts: 436
Location: chennai, India

PostPosted: Sat Mar 05, 2011 12:53 pm    Post subject: check for empty records in multiple files
Reply with quote

For single file, I understand hw to check for empty records in it and how to handle. I have 5 files to check for empty and process accordingly.

can you please confirm whether I could handle empty file condition in seperate steps for each file or can i handle the empty file condition in single step. If i can handle in single step, please let me know about the details. Thanks for your help.
Back to top
View user's profile Send private message

kratos86

Active User


Joined: 17 Mar 2008
Posts: 148
Location: Anna NGR

PostPosted: Sat Mar 05, 2011 4:04 pm    Post subject:
Reply with quote

If you want to set a return code separately you should go for seperate steps. If not you can handle that using an IDCAMS or a ICETOOL using multiple input files.
Back to top
View user's profile Send private message
kratos86

Active User


Joined: 17 Mar 2008
Posts: 148
Location: Anna NGR

PostPosted: Sat Mar 05, 2011 4:18 pm    Post subject:
Reply with quote

Things you might need to consider here is - In case you providing all the 5 files into the ICETOOL to check for empty condition.

Code:
COUNT FROM(IN1) EMPTY 
COUNT FROM(IN2) EMPTY 
COUNT FROM(IN3) EMPTY 
COUNT FROM(IN4) EMPTY 
COUNT FROM(IN5) EMPTY 


Suppose if the file3 and file4 is empty, the conditions will get executed until the file3 and subsequent check for the remaining files are skipped.
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Sun Mar 06, 2011 1:50 pm    Post subject:
Reply with quote

Hi,

when all files are tested in a single step, how do you then determine which is the empty file if any ?

I think the option of testing each file in a separate step is the way to go.

Gerry
Back to top
View user's profile Send private message
prino

Senior Member


Joined: 07 Feb 2009
Posts: 1027
Location: Oostende, Belgium

PostPosted: Sun Mar 06, 2011 5:47 pm    Post subject:
Reply with quote

gcicchet wrote:
when all files are tested in a single step, how do you then determine which is the empty file if any ?


Not impossible, if you issue a return code between 0 (no empty files) and 31 (all files are empty), but processing it will rather complex. icon_lol.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Sun Mar 06, 2011 9:20 pm    Post subject: Reply to: check for empty records in multiple files
Reply with quote

Quote:
... check for empty records in multiple files..

Quote:
... can you please confirm whether I could handle empty file condition ...


after 457 post You should have learned how to express Yourself better in order to get proper help

just take a decision... what do You want to check
empty ( whatever it means ) records
or empty ( not containing any records) files

until You learn how to use proper IT terminology we are just wasting time!
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Mon Mar 07, 2011 4:19 am    Post subject:
Reply with quote

Hi Robert,

I agree wholeheartedly with your comments and yes processing the files would become rather messy but achievable.


Gerry
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: Mon Mar 07, 2011 5:24 am    Post subject:
Reply with quote

Hello,

Possibly i misunderstand, but i believe the request is how to do this with the sort or idcams or similar.

With any of these, i believe it will be more work than radhakrishnan will want to invest (even if it is possible).

If these can be concatenated, it would be possible to interleave a "header" before each file and then use prino's suggestion about the return code. If one was willing to write their own code, this would take very little time. If these cannot be concatenated, it would require 5 fd's rather tha none, but then no "file headers" would be needed. . .

Quote:
If i can handle in single step, please let me know about the details.
The details would completely depend on how the processing after the "empty checks" was to be done. Determining if there are any empty files may be less challenging than determining the rest of the processing.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10274
Location: italy

PostPosted: Mon Mar 07, 2011 6:06 am    Post subject: Reply to: check for empty records in multiple files
Reply with quote

all depends on the quirks of the return code to be provided!
if the TS has to handle all the combination of empty files,
a rexx wrapper is the best way, in order to build a proper return code

from right to left
bit 0 on for first file empty
bit 1 on for second file empty
...
bit 4 for the fifth file empty

the return code could be flipped the other way around but the logic would not change

I wonder about the requirement ...
but from a mathematics and logic point of view it' s a sound solution


something like

Code:
000001 //USER1 JOB NOTIFY=&SYSUID,
000002 //             MSGLEVEL=(1,1),CLASS=A,MSGCLASS=X
000003 //*
000004 //IKJ      EXEC PGM=IKJEFT1B,PARM='CHECKER'
000005 //SYSPROC    DD DISP=SHR,DSN=USER.TEST.CLIST
000006 //*
000007 //DD01       DD *
000008
000009 //DD02       DD *
000010 //DD03       DD *
000011 //DD04       DD *
000012 //DD05       DD *
000013
000014 //SYSTSIN    DD *
000015 //SYSPRINT   DD SYSOUT=*
000016 //SYSTSPRT   DD SYSOUT=*


and USER.TEST.CLIST would contain a member called CHECKER

Code:
000001 /* rexx */
000002 retRC = 0
000003 Address TSO
000004 "print infile(dd01) count(1)"
000005 if rc <> 0 then retRC = retRC + 1
000006 "print infile(dd02) count(1)"
000007 if rc <> 0 then retRC = retRC + 2
000008 "print infile(dd03) count(1)"
000009 if rc <> 0 then retRC = retRC + 4
000010 "print infile(dd04) count(1)"
000011 if rc <> 0 then retRC = retRC + 8
000012 "print infile(dd05) count(1)"
000013 if rc <> 0 then retRC = retRC + 16
000014 return retRC


quick and dirty, no frills, just for a proof of concept

since files 2,3,4 are ampty a return code 14 is produced 2+4+8
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Changeman get multiple "Browse C... elixir1986 Compuware & Other Tools 4 Fri Jul 14, 2017 1:48 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts getting three output files out of JOI... migusd SYNCSORT 7 Mon Jun 05, 2017 11:30 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm


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