Selecting either of 2 i/p files using SORT JCL



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

Selecting either of 2 i/p files using SORT JCL

Postby gershome » Sat Jan 13, 2018 6:01 pm

Hi, I have three input files(IN1, IN2, IN3).
IN1 will have either 'Y' or 'N'
If it is 'Y', I need IN2 to be copied to the sort out file
If it is 'N', I need IN3 to be copied to the sort out file.

Can someone help me out on the logic using SORT JCL?
Note: There should be only one o/p file, i.e. either IN2 or IN3.
gershome
 
Posts: 3
Joined: Sat Jan 13, 2018 5:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Selecting either of 2 i/p files using SORT JCL

 

Re: Selecting either of 2 i/p files using SORT JCL

Postby NicC » Sun Jan 14, 2018 3:29 am

Are you wanting the sort JCL or the sort control cards?

I think something like this was asked before so have you searched the forum?

BTW - in MVS they are data sets not files. Files are the pipelines between your program and the data set.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2751
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 110 times

Re: Selecting either of 2 i/p files using SORT JCL

Postby gershome » Mon Jan 15, 2018 7:42 am

Hi, I would need the sort control card.
I have tried in the forum, but couldn't find one..
gershome
 
Posts: 3
Joined: Sat Jan 13, 2018 5:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Selecting either of 2 i/p files using SORT JCL

Postby NicC » Mon Jan 15, 2018 4:41 pm

I had a big look around several forums and going back 2 years but could not find what I was looking for. However...
I think the answer is that you cannot use sort to select your input data set. That has to be done by another process. There ar 2 ways I can think of off the top of my head:
1 - code a small program to read data set 1 and set a return code. Have two sort steps following - one for each data set. Which step is to be executed will be determined by the return code from the first step.
2 - code a small program to read data set 1 and generate and submit a sort job with the appropriate input data set.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2751
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 110 times

Re: Selecting either of 2 i/p files using SORT JCL

Postby gershome » Mon Jan 15, 2018 5:27 pm

Thanks Nic for your response.
gershome
 
Posts: 3
Joined: Sat Jan 13, 2018 5:55 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Selecting either of 2 i/p files using SORT JCL

Postby Aki88 » Sat Feb 10, 2018 12:09 am

Hello,

Am fairly sure that this requirement is closed by now; but just in case you still want to explore an option of doing it in *SORT, here is a plausible solution.
This is untested, as I haven't had access to mainframe for sometime now, but this should work, errors if any, should be minor.

The new jobs that will be submitted will have IN2 or IN3 depending upon the INCLUDE condition's result.


//SORTIN   DD *                                                
Y                                                              
/*                                                              
//IN2      DD SYSOUT=(*,INTRDR)                                
//IN3      DD SYSOUT=(*,INTRDR)                                
//SYSIN    DD *                                                
 SORT FIELDS=COPY                                              
 OUTFIL INCLUDE=(1,1,CH,EQ,C'Y'),                              
        FNAMES=IN2,                                            
        BUILD=(C'//TEST#    JOB ''',C' ''',C',''TEST'',',/,    
              C'//         CLASS=A,MSGCLASS=X,             ',/,
              C'//         MSGLEVEL=(1,1),NOTIFY=&SYSUID,  ',/,
              C'//         REGION=0M                       ',/,
              C'//*',77X,/,                                    
              C'//STEP001  EXEC PGM=SORT                   ',/,
              C'//DFSMSG   DD SYSOUT=*                     ',/,
              C'//SORTIN   DD DISP=SHR,DSN=<IN2>           ',/,
              C'//SORTOUT  DD SYSOUT=*                     ',/,
              C'//SYSIN    DD *                            ',/,
              C' SORT FIELDS=COPY                          ',/,
              C'/*                                         ',/,
              C'//',78X)                                        
 OUTFIL INCLUDE=(1,1,CH,EQ,C'N'),                              
        FNAMES=IN3,                                            
        BUILD=(C'//TEST#    JOB ''',C' ''',C',''TEST'',',/,    
              C'//         CLASS=A,MSGCLASS=X,             ',/,
              C'//         MSGLEVEL=(1,1),NOTIFY=&SYSUID,  ',/,
              C'//         REGION=0M                       ',/,
              C'//*',77X,/,                                    
              C'//STEP001  EXEC PGM=SORT                   ',/,
              C'//DFSMSG   DD SYSOUT=*                     ',/,
              C'//SORTIN   DD DISP=SHR,DSN=<IN3>           ',/,
              C'//SORTOUT  DD SYSOUT=*                     ',/,
              C'//SYSIN    DD *                            ',/,
              C' SORT FIELDS=COPY                          ',/,
              C'/*                                         ',/,
              C'//',78X)                                        
/*                                                              

 
Aki88
 
Posts: 377
Joined: Tue Jan 28, 2014 1:52 pm
Has thanked: 33 times
Been thanked: 36 times


Return to DFSORT/ICETOOL/ICEGENER

 


  • Related topics
    Replies
    Views
    Last post