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
 

 

handling the empty file condition

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

New User


Joined: 31 Oct 2006
Posts: 29
Location: brisbane

PostPosted: Thu Aug 09, 2007 7:33 am    Post subject: handling the empty file condition
Reply with quote

I have a requirement to process an input file and produce a comma separated list of numbers.

My input data set could contain 0, 1 or more rows, and for each I want a different output format.

If input is empty, I want one output row containing "0"
if input contains one row, i want just the relevant value from that row.
if input contains more than one row, i want a comma separated list of the relevant values.

So, to make this clearer, suppose my input file had the relevant value at (34,9). My copy step could look something like :

//CPY1CNTL DD *
INREC OVERLAY=(1:SEQNUM,8,ZD)
OUTREC IFTHEN=(WHEN=(1,8,CH,EQ,C'00000001'),
BUILD=(1:C' ',2:34,9,11:70X)),
IFTHEN=(WHEN=NONE,
BUILD=(1:C',',2:34,9,11:70X))
/*


but this only works when the input file is non-empty.

SO...

I could either throw an RC4 on the empty input file condition, and handle this in a separate IF step

or

use HEADER1/TRAILER1 with a constant value of '0'. But there are two problems in doing this :

1. I would get the '0' for all input states, and so I would have to strip this for the non-null condition.
2. I am writing to FB (not FBA) ... i don't know how to do this without getting an ICE224A error ..


is there a elegant one (or two) step solution to give me what I want ? two steps would be great .. one would be really flash.
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: Thu Aug 09, 2007 10:54 pm    Post subject:
Reply with quote

It's not clear what you want to do. Please show an example of the input record(s) and the expected output record(s) for one row, two rows and five rows.

What is the RECFM and LRECL of the input file?

What is the RECFM and LRECL of the output file?

Quote:
2. I am writing to FB (not FBA) ... i don't know how to do this without getting an ICE224A error ..


The Programmer Response for ICE224A tells you how to do that (e.g. OUTFIL REMOVECC parameter):

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CM20/2.2.213?SHELF=&DT=20060721170811&CASE=

Just out of curiosity, is there some reason you couldn't look up the ICE224A message?
Back to top
View user's profile Send private message
jzhardy

New User


Joined: 31 Oct 2006
Posts: 29
Location: brisbane

PostPosted: Fri Aug 10, 2007 9:00 am    Post subject: Re: handling the empty file condition
Reply with quote

Input file is : RECFM=FB,LRECL=300,BLKSIZE=0

Output is a PDS of type FB 80 (but in some environments this same pds is defined as FBA 80)


For empty input I would like output of :

-1



For input of one row I want just the key value.

eg -

input :
111 xxx

output:
111



For input of more than one row, I want a comma separate list of values

eg -

input
111 xxx
222 yyy

output
111
,222


The following sort job does what I want, but imho does not look that elegant.


//SORT01 EXEC PGM=ICETOOL
//*
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//TOOLIN DD *
*
* dedup and extract key value :
*
SELECT FROM(SORTIN) TO(WORK01) ON(34,9,CH) FIRST USING(SEL1)
*
* REMOVE ASA CHARACTER :
*
COPY FROM(WORK01) TO(PRMLIB) USING(CPY1)
*
/*
//SEL1CNTL DD *
OUTFIL FNAMES=WORK01, REMOVECC,
HEADER1=(1:'-1'),
BUILD=(1:C',',2:34,9,11:69X)
//*
//CPY1CNTL DD *
OUTFIL FNAMES=PRMLIB,
BUILD=(1:2,79,X)
//*
//SORTIN DD DSN=%%HLQSOUT..%%JOBNAME.D%%ODATE.O%%ORDERID.DAT,
// DISP=SHR
//*
//WORK01 DD DSN=&&WORK01,
// DISP=(,PASS),
// SPACE=(%%ALUNIT,(%%PRIS,%%SECS),RLSE),
// RECFM=FBA,LRECL=80,BLKSIZE=0
//*
//PRMLIB DD DSN=TRAILSD4.PARMLIB(TCASIDS),DISP=SHR
//*




also ...

When I looked up ICE224A in my manual i didn't get anything about the REMOVCC option :


-'DFSORT messages, codes and diagnosis guide' :


ICE224A ddname CANNOT BE USED FOR A
REPORT
Explanation: Critical. The OUTFIL report specified for
the OUTFIL data set associated with ddname cannot be
produced because either:

v the OUTFIL data set is VSAM, or
v the record format specified or retrieved for the
OUTFIL data set does not contain ’A’ (ASA carriage
control characters).

System Action: The program terminates.

Programmer Response: If the OUTFIL data set is
VSAM, it cannot be used for a report. If the OUTFIL
data set is non-VSAM, either let DFSORT set the
RECFM appropriately or specify a RECFM that includes
’A’.
Back to top
View user's profile Send private message
jzhardy

New User


Joined: 31 Oct 2006
Posts: 29
Location: brisbane

PostPosted: Fri Aug 10, 2007 9:01 am    Post subject: Re: handling the empty file condition
Reply with quote

.. but not quite ...

the problem is that it puts the '-1' on all outputs. This is something that I can live with, but was not exactly what i wanted ..
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 Aug 10, 2007 7:56 pm    Post subject:
Reply with quote

Quote:
When I looked up ICE224A in my manual i didn't get anything about the REMOVCC option :


You're looking at an old version of the book from before REMOVECC was available. For the latest version of the DFSORT books, you should always look at:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html

I'll take a look at your question later today.
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 Aug 10, 2007 8:47 pm    Post subject:
Reply with quote

Still looking at this, but I noticed you have a blank before REMOVECC in:

Code:

    OUTFIL FNAMES=WORK01, REMOVECC,       


The blank makes DFSORT ignore REMOVECC. If you remove the blank:

Code:

    OUTFIL FNAMES=WORK01,REMOVECC,       


REMOVECC will be used and you won't get the ASA character so you won't need the extra COPY operator.
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 Aug 10, 2007 9:42 pm    Post subject:
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for:

Code:

//S1    EXEC PGM=ICETOOL
//TOOLMSG   DD SYSOUT=*
//DFSMSG    DD SYSOUT=*
//IN DD DSN=... input file (FB/300)
//CT DD DSN=&&C1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//CON DD DSN=*.CT,VOL=REF=*.CT,DISP=(OLD,PASS)
//    DD DSN=*.T1,VOL=REF=*.T1,DISP=(OLD,PASS)
//OUT DD DSN=..  output file (FB/80)
//TOOLIN    DD *
SELECT FROM(IN) TO(CT) ON(1,9,CH) FIRST USING(CTL1)
COPY FROM(CON) TO(OUT) USING(CTL2)
/*
//CTL1CNTL  DD *
  INREC BUILD=(1:34,9)
  OUTFIL FNAMES=CT,REMOVECC,NODETAIL,
    BUILD=(88X),
    TRAILER1=(COUNT=(M11,LENGTH=8),81:C'00000000')
  OUTFIL FNAMES=T1,BUILD=(1,9,81:SEQNUM,8,ZD)
/*
//CTL2CNTL  DD *
   INREC IFTHEN=(WHEN=(81,8,ZD,EQ,0,AND,1,8,ZD,EQ,0),
    BUILD=(C'-1',81:81,8),HIT=NEXT),
   IFTHEN=(WHEN=(81,8,ZD,EQ,1),BUILD=(1,9,81:81,8)),
   IFTHEN=(WHEN=(81,8,ZD,GT,1),BUILD=(C',',1,9,81:81,8))
  OUTFIL FNAMES=OUT,OMIT=(81,8,ZD,EQ,0,AND,1,8,CH,NE,C'-1'),
    BUILD=(1,80)
/*
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 Split file based on comparsion to 2 f... Div Grad DFSORT/ICETOOL 3 Thu Jul 27, 2017 9:16 pm
No new posts Extra character appears in file when ... Balu5491 All Other Mainframe Topics 1 Wed Jul 26, 2017 2:39 pm
No new posts SSH - known_hosts file configuration vasanthz All Other Mainframe Topics 2 Wed Jul 26, 2017 2:10 am
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am


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