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

Joinkeys with condition


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

New User


Joined: 06 Sep 2006
Posts: 44
Location: United States

PostPosted: Tue Feb 14, 2017 12:20 am
Reply with quote

Hi,
Appreciate your help on following requirement:

I've 2 input files(File1 with length:437 and file2 with length:46), with the below sort card am able to create an output(file length:500) which is working as expected:
Code:
//COMPARE  EXEC PGM=SORT                                       
//UNLD   DD DSN=INPUT.FILE1,DISP=SHR                                         
//EXTRCT  DD DSN=INPUT.FILE2,DISP=SHR                         
//SORTOUT  DD DSN=OUTPUT.FILE1,DISP=(,CATLG)                       
//SYSIN    DD *
SORT FIELDS=COPY                           
JOINKEYS F1=UNLD,FIELDS=(7,20,A)         
JOINKEYS F2=EXTRCT,FIELDS=(27,20,A)       
JOIN UNPAIRED,F1                           
REFORMAT FIELDS=(F2:5,20,F2:25,2,F1:1,437) 


based on above results(derived from sortout(file) results),Now I need to add 2 more output files(in this same step), if I see spaces in 1st 20 character(1,20,CH,EQ,C' ') of OUTPUT.FILE1 need to write output file2 and if there is no spaces(1,20,CH,NE,C' ') need to write output file3

Thanks in advance

CODED and moved to the correct forum, please bear this in mind in the future
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Feb 14, 2017 1:07 am
Reply with quote

scdinesh,

I think your previous topic was a multiple output requirement. Use INCLUDE/OMIT for each OUTFIL group as needed. Plenty of examples here.
Back to top
View user's profile Send private message
scdinesh

New User


Joined: 06 Sep 2006
Posts: 44
Location: United States

PostPosted: Tue Feb 14, 2017 1:57 am
Reply with quote

Hi Arun,
I tried below option with 'INCLUDE/OUTFIL' , am getting desired result in sortout file but empty on both output File1/ File2 , challenge here is need to derive File1 and File2 upon result from sortout file

SORT FIELDS=COPY
JOINKEYS F1=UNLOAD,FIELDS=(7,20,A)
JOINKEYS F2=EXTRACT,FIELDS=(27,20,A)
JOIN UNPAIRED,F1
REFORMAT FIELDS=(F2:5,20,F2:25,2,F1:1,437)

OUTFIL INCLUDE=(1,20,CH,EQ,C' '),FILES=01
OUTFIL INCLUDE=(1,20,CH,NE,C' '),FILES=02
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Feb 14, 2017 3:03 am
Reply with quote

This should not be a challenge. Since you have given mutually exclusive INCLUDE conditions in your OUTFILs, I would expect some data in at least one of these output DDs, unless you have used something else in your actual run. BTW are you using SORTOF01 and SORTOF02 DDs?

How about posting here the complete JCL and control statements from your actual run. While posting code/sample data, Select the content, Click the 'Code' button in the editor, and Preview it to make sure it looks good, before posting.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Feb 14, 2017 3:49 am
Reply with quote

Please post the full SYSOUT from the step. In the Code tags.
Back to top
View user's profile Send private message
scdinesh

New User


Joined: 06 Sep 2006
Posts: 44
Location: United States

PostPosted: Wed Feb 15, 2017 4:15 am
Reply with quote

Thanks Arun and Bill for the Response:

Code:

//COMPARE  EXEC PGM=SORT                                       
//UNLOAD   DD DSN=TEST.ACCTBL.UNLD,
//            DISP=SHR                                         
//EXTRACT  DD DSN=TEST.MAST.EXTRACT,     
//            DISP=SHR                                         
//SORTOUT  DD DSN=TEST.COMPR.SMPLFILE,       
//            DISP=(,CATLG,DELETE),                           
//            SPACE=(TRK,(100,100),RLSE),                     
//            BLKSIZE=0,                                       
//            LRECL=500,                                       
//            RECFM=FB                                         
//SORTOF01 DD DSN=TEST.OPDTL.RECS1,           
//            DISP=(,CATLG,DELETE),                           
//            SPACE=(TRK,(100,100),RLSE),                     
//            BLKSIZE=0,                                       
//            LRECL=500,                                       
//            RECFM=FB                                         
//SORTOF02 DD DSN=TEST.NONOPDTL.RECS1,       
//            DISP=(,CATLG,DELETE),                           
//            SPACE=(TRK,(100,100),RLSE),                     
//            BLKSIZE=0,                                       
//            LRECL=500,                                       
//            RECFM=FB
//SYSOUT   DD SYSOUT=*                       
//SYSIN    DD *                             
  SORT FIELDS=COPY                           
  JOINKEYS F1=UNLOAD,FIELDS=(7,20,A)         
  JOINKEYS F2=EXTRACT,FIELDS=(27,20,A)       
  JOIN UNPAIRED,F1                           
  REFORMAT FIELDS=(F2:5,20,F2:25,2,F1:1,437)
//*                                         
  OUTFIL INCLUDE=(1,20,CH,EQ,C'  '),FILES=01
  OUTFIL INCLUDE=(1,20,CH,NE,C'  '),FILES=02

am able to receive expected result in Sortout file , but File 01/02 is empty



Bill,
Please letme know if you need anything specific from sysout? Thanks for your help in advance

Half-coded
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Feb 15, 2017 4:18 am
Reply with quote

You have an embedded comment line '//*' in your SYSIN card which I think 'helps' DFSORT IGNORE your OUTFILs (explains your empty SORTOF* outputs)
Have you looked at your SYSOUT yet? I would suggest you start doing that before coming to the forums.

btw, are you still having trouble using the Code button here?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Wed Feb 15, 2017 7:54 am
Reply with quote

If you look at the SYSOUT from you step, you'll see your OUTFILS do not even appear. If you look around further (like file 2 of the spool output for your JOB) you'll find an unnumbered //SYSIN DD * statement saying "GENERATED STATEMENT".

You can't have random cards in a JOB-deck which are not JCL and not data-cards, so if JES finds that situation, it generates the DD statement that you have "forgotten".

If you want to separate parts of your code with comment lines, have an "*" ads the first character. Entirely blank lines are also fine. What you can't do is use a JCL comment, because the input stream is ended by the first JCL statement that it is en, or by "/*" or (for SORT) by an " END".

We could guess your issue, not necessarily its exact form, because you had OUTFILs with apparently mutually-exclusive conditions. The only way both could be empty would be if your input was empty.

You should also look at SAVE on OUTFIL. SAVE says "write here anything which has not appeared on any other OUTFIL". It is like an "ELSE" for OUTFIL INCLUDE/OMIT. Saves you coding negated conditions or entire sets of conditions which are mutually exclusive.
Back to top
View user's profile Send private message
scdinesh

New User


Joined: 06 Sep 2006
Posts: 44
Location: United States

PostPosted: Wed Feb 15, 2017 9:44 pm
Reply with quote

Thanks Arun, Bill for the help. It is working now.

@Arun - You are right , '//*' in your SYSIN card ignores the OUTFIL statement. I've seen the sysout before posting to this forum, was clueless.

My initial thought was if it ignored OUTFIL statement , then how come it would create SORTOF* outputs without any warning or failure ?
Bill answered that...

On Code button, as you mentioned earlier I've used that while posting this. but I don't know still if you find any issues

@Bill:Thanks for the explanation and additional information.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Feb 15, 2017 10:33 pm
Reply with quote

scdinesh wrote:
On Code button, as you mentioned earlier I've used that while posting this. but I don't know still if you find any issues
Yes, it was not 'coded' correctly. Someone did it for you (see the red note). Like I said, do 'preview' in the future.

scdinesh wrote:
if it ignored OUTFIL statement , then how come it would create SORTOF* outputs without any warning or failure ?
DFSORT did not even know about your OUTFILs to issue any error. You can allocate any random data set in your JCL with DDnames - //SORTOF01 //SORTOF02 or //RANDOM or whatever. If you have the allocation parameters right, you will have it created successfully. So there is no question of failure/warning.

On the other hand, if you have a control card with the OUTFIL FILES/FNAMES coded correctly (with no embedded //*), and if you miss the corresponding DDnames in your JCL, then DFSORT will issue an error. Not the other way around.
Back to top
View user's profile Send private message
scdinesh

New User


Joined: 06 Sep 2006
Posts: 44
Location: United States

PostPosted: Wed Feb 15, 2017 11:56 pm
Reply with quote

Very well explained Arun. icon_smile.gif
Thank you
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 Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts PD not working for unsigned packed JO... DFSORT/ICETOOL 5
No new posts Def PD not working for unsigned packe... JCL & VSAM 3
No new posts Sort with JOINKEYS using two VB files DFSORT/ICETOOL 1
No new posts How to give complex condition in JCL . CLIST & REXX 30
Search our Forums:

Back to Top