can i dot it in one step



IBM's flagship sort product DFSORT for sorting, merging, copying, data manipulation and reporting. Includes ICETOOL and ICEGENER

can i dot it in one step

Postby wove » Thu Mar 15, 2012 3:47 pm

I have two input files.

File1 & file2

When file2 is empty I must write the value “9999999” to the out-record.
When file2 is not empty is must write the records who are in file1 and not in file2 to the out-record.

Now I know that I can do the control of empty with “count” statement, and the join with JKFROM. But I must write it in different jcl’s.

Can I do it in one JCL?
wove
 
Posts: 4
Joined: Wed Dec 09, 2009 2:15 am
Has thanked: 0 time
Been thanked: 0 time

Re: can i dot it in one step

Postby BillyBoyo » Thu Mar 15, 2012 8:00 pm

You need to provide a bit more information.

What is the key for the matching? What are lrecl/recfm for all files (presumably they are the same, but...?).

If file2 is empty, what do you want to do with file1? Ignore all the records, so output just has the nines?

Anything else you can think of that is needed to be known.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: can i dot it in one step

Postby wove » Mon Mar 19, 2012 4:07 pm

Hello,

If the file2 is empty than the output is a single record “9999999”
When file2 is not empty than i must do a jkey.
I know the code for the jKEY
//RWSORT01 EXEC PGM=ICETOOL
//TOOLMSG  DD SYSOUT=*
//DFSMSG   DD SYSOUT=*
//SYSOUT   DD  SYSOUT=*
//* SORT PARAM -------------------------------------------
//TOOLIN   DD DISP=SHR,
//         DSN=B4T1.RW.DB.V000.JCLDATA(J01S00)
//CTL1CNTL DD DISP=SHR,
//         DSN=B4T1.RW.DB.V000.JCLDATA(J01S01)
//*  INPUT FILE ------------------------------------------
//*  INPUT INPUT FILE DOMICILIATIONS ÉMISES---------------
//IN1      DD DISP=SHR,
//            DSN=Q9T1.RW.DD.V000.LFP02D00
//*  INPUT FILE DOMICILIATIONS IMPAYÉES ------------------
//IN2      DD DISP=SHR,
//            DSN=Q2T1.RW.DD.V000.LFJ01D00
//*  FILE INTERMEDIARE ----------------------------------------------
//T1       DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//* OUTPUT FILE ------------------------------------------
//OUT      DD DISP=(NEW,CATLG,DELETE),
//            DSN=Q2T1.RW.DD.V000.LFJ01S00,
//            DATACLAS=BATL,
//            LRECL=80,RECFM=FB


TOOLIN
  SORT JKFROM    TO(T1) USING(CTL1)


CTL1CNTL
  JOINKEYS F1=IN1,FIELDS=(47,12,A)
  JOINKEYS F2=IN2,FIELDS=(1,12,A)
  REFORMAT FIELDS=(F1:1,80)
  OPTION COPY


For testing of the file2 is empty:

//toolin DD *
Count from(in) empty RC4



Now i do a check on the return code, is the returncode = 0 we run the jcl with the jkey in, when returncode <> 0 create output single record with “9999999”

Can i do that in one jcl run?
wove
 
Posts: 4
Joined: Wed Dec 09, 2009 2:15 am
Has thanked: 0 time
Been thanked: 0 time

Re: can i dot it in one step

Postby BillyBoyo » Mon Mar 19, 2012 5:04 pm

You can very readily do it in one Job, with two steps, those that you have. Are you asking if it can be done in one step?

Since you set the RC to 4 for an empty file, best to check for equal to 4, not not-equal-to-zero. Then do "something else for greater than 4. Else RC of 8, 12, 16 or even 20 and you'll just carry on as normal, which would not be good.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: can i dot it in one step

Postby wove » Mon Mar 19, 2012 5:11 pm

BillyBoyo thanks for the reponse.
Is there away to do this in one step? Is it possible to do a "if then..." in the TOOLIN?
wove
 
Posts: 4
Joined: Wed Dec 09, 2009 2:15 am
Has thanked: 0 time
Been thanked: 0 time

Re: can i dot it in one step

Postby BillyBoyo » Mon Mar 19, 2012 5:28 pm

The DFSORT developers will be checking-in at the start of the working day West-Coast USA time, they'll give the best answer. I'm trying to get you to clarify so there is no more toing-and-froing then.

Do you need the RC=4 for anything except putting the 9s on the output file? Is it information you have other processing for?
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: can i dot it in one step

Postby wove » Mon Mar 19, 2012 5:45 pm

No, i don't need the RC=4. I was just using that to say to control-m which step he has to take.
wove
 
Posts: 4
Joined: Wed Dec 09, 2009 2:15 am
Has thanked: 0 time
Been thanked: 0 time

Re: can i dot it in one step

Postby BillyBoyo » Tue Mar 20, 2012 4:58 am

OK, I've got more time, so here's my attempt:

I've done it just as a plain SORT with JOINKEYS. There is a presumption that both files are to be sorted in the join, but that is not relevant to the solution.

The idea is to "concatenate" a "999999999999" record to each input dataset (INA and INB).

If the main file for INB is empty, INB will only contain that 999999999999 record.

In this case, the only match you will get will be the 999999999999 record, so that is what will be on your output.

In the case of records on INB which match, the trick is then to avoid writing the 999999999999 record as it is not needed when there is data.

This is achieved by appending a sequence number to each record. This will never appear on the output file, because the IFOUTLEN=80 will cut it off as the records are written.

When the 999999999999 record is reached, the sequence number is tested. If not 00000001, the 999999999999 is "marked" for exclusion, I have in this example put an "O" (letter "O") in place of the final digit.

The unwanted 99999999999O record is then OMITted with OUTFIL.


//STEPEMPT EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTOUT  DD SYSOUT=*
//SYSIN    DD *
  JOINKEYS F1=INA,FIELDS=(1,12,A)
  JOINKEYS F2=INB,FIELDS=(1,12,A)
  REFORMAT FIELDS=(F1:1,80)
                                                         
  OPTION COPY
  INREC IFOUTLEN=80,
        IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD)),
        IFTHEN=(WHEN=(1,12,CH,EQ,C'999999999999',
                  AND,81,8,CH,NE,C'00000001'),
                  OVERLAY=(12:C'O'))
  OUTFIL OMIT=(1,12,CH,EQ,C'99999999999O')
//INA      DD *
111111111120 DATA
111111111111 DATA
111111111112 DATA
111111111113 DATA
111111111114 DATA
111111111115 DATA
111111111116 DATA
111111111117 DATA
111111111118 DATA
111111111119 DATA
999999999999
//INB      DD *
999999999999


Output from the above,
999999999999


Output with this for INB

111111111119 DATA
999999999999

111111111119 DATA


I've used my own data and positions for testing, but you should be able to apply it to your requirement if necessary.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post