MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Getting Output from 2 Files

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
davinski.bby
Beginner


Joined: 30 Jul 2007
Posts: 31
Topics: 10

PostPosted: Tue Aug 14, 2007 12:46 am    Post subject: Getting Output from 2 Files Reply with quote

Hi,

I may have posted this query in the JCL topics. I have seen some similar queries but I am new with JCLs and I ask for your patience... Very Happy

Here is my query:

I have 2 datasets:

Code:

FILE 1 - RECORD LENGTH IS 200


NUM-ID1-FILLER NUM-TXT  NUM-REFRENCE-NBR NUM-200-FILLER
5/NUM          7/NUM    6/NUM            4/NUM           
(1-5)          (6-12)   (13-18)          (19-200)         
4------------- 5------- 7--------------- 8-------------...200
********************************* TOP OF DATA ***************
             0  6282854              176                    1
             0  6465103              176                    1
             0  7479141              176                    1
             0  7161741              342                    1
             0  7033998              476                    1
             0  4042119              477                    1
             0  7284556              477                    1
             0  7479089              583                    1
             0  7479089              592                    1
             

FILE 2 - RECORD LENGTH IS 300

NUM-STR-POS NUM-END-POS   NUM-REFRENCE-NBR NUM-CHECK-DATE
4/NUM        4/NUM        6/NUM            8/NUM         
(1-4)        (5-8)        (9-14)           (15-300)       
3----------- 5----------- 7--------------- 9---------...300
********************************* TOP OF DATA **************
          99          912              176          20070621
          99          912              223          20070711
          99          912              342          20070602
          99          912              376          20070725
          99          912              397          20070630
          99          912              475          20070525
          99          912              476          20070620
          99          912              477          20070627
         
         
         
OUTPUT should be ALL RECORDS FROM FILE 1 which has a CORRESPONDING NUM-REFRENCE-NBR IN FILE 2

NUM-ID1-FILLER NUM-TXT  NUM-REFRENCE-NBR NUM-200-FILLER
5/NUM          7/NUM    6/NUM            4/NUM           
(1-5)          (6-12)   (13-18)          (19-200)         
4------------- 5------- 7--------------- 8-------------...200
********************************* TOP OF DATA ***************
             0  6282854              176                    1
             0  6465103              176                    1
             0  7479141              176                    1
             0  7161741              342                    1
             0  4042119              477                    1
             0  7284556              477                    1




How do I do this?

Thanks.
Back to top
View user's profile Send private message
davinski.bby
Beginner


Joined: 30 Jul 2007
Posts: 31
Topics: 10

PostPosted: Tue Aug 14, 2007 12:50 am    Post subject: Reply with quote

0 7033998 476 1
should also be included Smile

See output below:

Thanks again.


Code:


NUM-ID1-FILLER NUM-TXT  NUM-REFRENCE-NBR NUM-200-FILLER
5/NUM          7/NUM    6/NUM            4/NUM           
(1-5)          (6-12)   (13-18)          (19-200)         
4------------- 5------- 7--------------- 8-------------...200
********************************* TOP OF DATA ***************
             0  6282854              176                    1
             0  6465103              176                    1
             0  7479141              176                    1
             0  7161741              342                    1
             0  7033998              476                    1
             0  4042119              477                    1
             0  7284556              477                    1


Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Aug 14, 2007 7:03 am    Post subject: Reply with quote

Quote:

I may have posted this query in the JCL topics. I have seen some similar queries but I am new with JCLs and I ask for your patience...

davinski.bby,

Please do NOT post the same question in multiple forums. Please SEARCH before posting. Check this link

http://www.mvsforums.com/helpboards/viewtopic.php?t=5399

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
davinski.bby
Beginner


Joined: 30 Jul 2007
Posts: 31
Topics: 10

PostPosted: Tue Aug 14, 2007 7:52 am    Post subject: Reply with quote

I used this and it does not produce any output.

Code:

//TESTJCL JOB (T,A05,0988),'SORT',                 
//             CLASS=X,MSGCLASS=X,NOTIFY=&SYSUID   
//STEP0100 EXEC PGM=SORT                           
//SYSOUT   DD SYSOUT=*                             
//SORTJNF1 DD  DSN=DATASET1,   
//             DISP=SHR                             
//SORTJNF2 DD  DSN=DATASET2,
//             DISP=SHR                             
//SORTOUT  DD  DSN=DATASET.OUT3,
//             DISP=(NEW,CATLG,DELETE),           
//             UNIT=SYSDA,                         
//             SPACE=(CYL,(50,50),RLSE),           
//             DCB=(RECFM=FB,LRECL=351,BLKSIZE=0)
//SYSIN    DD *                                     
  JOINKEYS FILES=F1,FIELDS=(13,6,A)                 
  JOINKEYS FILES=F2,FIELDS=(09,6,A)                 
  REFORMAT FIELDS=(F1:1,200)                       
  SORT FIELDS=COPY                                 
/*                                                 


Please let me know what i did wrong. Thanks.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Aug 14, 2007 7:54 am    Post subject: Reply with quote

Quote:

I used this and it does not produce any output.

davinski.bby,

My crystal ball isn't that shiny and it does not show me your sysout. Show me your sysout

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
davinski.bby
Beginner


Joined: 30 Jul 2007
Posts: 31
Topics: 10

PostPosted: Tue Aug 14, 2007 4:17 pm    Post subject: Reply with quote

Hi Kolusu, sorry for that. I already got the correct out put. Thank you very much.
Back to top
View user's profile Send private message
davinski.bby
Beginner


Joined: 30 Jul 2007
Posts: 31
Topics: 10

PostPosted: Mon Aug 20, 2007 12:02 pm    Post subject: Reply with quote

Hi guys,

I got the matching records, now i also need to get the records that does not have any match and place them in anaother dataset?

can i still use join keys?

Thanks.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Aug 20, 2007 12:09 pm    Post subject: Reply with quote

davinski.bby,

Check this link for an example

http://www.mvsforums.com/helpboards/viewtopic.php?p=22582#22582

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
davinski.bby
Beginner


Joined: 30 Jul 2007
Posts: 31
Topics: 10

PostPosted: Mon Aug 20, 2007 6:26 pm    Post subject: Using JoinKeys Reply with quote

Hi Kolusu,

I tried to use JOINKEYS. I need to get all records in INPUT that has a matching key in INPUT2. INPUT1 has a record length of 45.
I also need to get the records in INPUT1 that do not matching key in INPUT2. Please see the code below:

Code:

//SHIPPER1 JOB (T,A05,0988),'SORT',             
//             CLASS=X,MSGCLASS=X,NOTIFY=&SYSUID
//********************************************* 
//STEP0100 EXEC PGM=SORT                         
//SYSOUT   DD SYSOUT=*                           
//SORTJNF1 DD  DSN=INPUTF1,     
//             DISP=SHR                         
//SORTJNF2 DD  DSN=INPUTF2,     
//             DISP=SHR                         
//MATCH    DD  DSN=F1REC.MATCH,       
//             DISP=(NEW,CATLG,DELETE),         
//             UNIT=SYSDA,                       
//             SPACE=(CYL,(1,1),RLSE),           
//             DCB=(RECFM=FB,LRECL=46,BLKSIZE=0)
//ONLYF1   DD  DSN=ONLYF1.NOMATCH,       
//             DISP=(NEW,CATLG,DELETE),             
//             UNIT=SYSDA,                         
//             SPACE=(CYL,(1,1),RLSE),             
//             DCB=(RECFM=FB,LRECL=46,BLKSIZE=0)   
//SYSIN    DD *                                     
  JOINKEYS FILES=F1,FIELDS=(1,17,A)                 
  JOINKEYS FILES=F2,FIELDS=(1,17,A)                 
  REFORMAT FIELDS=(F1:1,45),FILL=X'FF'             
  SORT FIELDS=COPY                                 
  JOIN UNPAIRED                                     
  OUTFIL FNAMES=ONLYF1,INCLUDE=(46,01,BI,EQ,X'FF'),
  OUTREC=(1,45)                                     
  OUTFIL FNAMES=MATCH,SAVE,                         
  OUTREC=(1,45)                                     
/*     


I am getting a CC=16.
Please see SYSOUT below:

Code:

SYNCSORT FOR Z/OS  1.2.2.3R
 
SYSIN :                                                           
  JOINKEYS FILES=F1,FIELDS=(1,17,A)                               
  JOINKEYS FILES=F2,FIELDS=(1,17,A)                               
  REFORMAT FIELDS=(F1:1,45),FILL=X'FF'                           
  SORT FIELDS=COPY                                               
  JOIN UNPAIRED                                                   
  OUTFIL FNAMES=ONLYF1,INCLUDE=(46,01,BI,EQ,X'FF'),               
  OUTREC=(1,45)                                                   
  OUTFIL FNAMES=MATCH,SAVE,                                       
  OUTREC=(1,45)                                                   
WER276B  SYSDIAG= 696723, 1293340, 1293340, 755430               
WER164B  5,788K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER164B     0 BYTES RESERVE REQUESTED, 1,020K BYTES USED         
WER481I  JOINKEYS REFORMAT RECORD LENGTH=   45, TYPE = F         
WER110I  ONLYF1   : RECFM=FB   ; LRECL=    46; BLKSIZE= 27968     
WER110I  MATCH    : RECFM=     ; LRECL=    45; BLKSIZE=           
WER247A  ONLYF1   HAS INCOMPATIBLE LRECL                         
WER425A  CONVERT FEATURE CANNOT BE USED WITH OVERLAY OR IFTHEN   
WER449I  SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE                     
WER482I  JNF1 STATISTICS                                         
WER483B  2,568K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER483B     0 BYTES RESERVE REQUESTED, 1,020K BYTES USED         
WER108I  SORTJNF1 : RECFM=FB   ; LRECL=    45; BLKSIZE= 27990     
WER482I  JNF2 STATISTICS                                         
WER483B  2,568K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER483B     0 BYTES RESERVE REQUESTED, 1,020K BYTES USED         
WER108I  SORTJNF2 : RECFM=FB   ; LRECL=    17; BLKSIZE= 27982     



My desired output would be matching records and not-matching records all coming from INPUT1.

Thanks.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Aug 21, 2007 7:33 am    Post subject: Reply with quote

Quote:

I also need to get the records in INPUT1 that do not matching key in INPUT2. Please see the code below:

davinski.bby,

Try this JCL. The cc of 16 is because you hardcoded an LRECL of 46 in your JCL , but your input is only 45. Also for SORT you don't have to code the DCB parameters , they are automatically copied from the input or calculated based on your outrec statement.

Code:

//STEP0100 EXEC PGM=SORT                         
//SYSOUT   DD SYSOUT=*                           
//SORTJNF1 DD  DSN=INPUTF1,     
//             DISP=SHR                         
//SORTJNF2 DD  DSN=INPUTF2,     
//             DISP=SHR                         
//MATCH    DD  DSN=F1REC.MATCH,       
//             DISP=(NEW,CATLG,DELETE),         
//             UNIT=SYSDA,                       
//             SPACE=(CYL,(1,1),RLSE),           
//             DCB=(RECFM=FB,LRECL=46,BLKSIZE=0)
//ONLYF2   DD  DSN=ONLYF2.NOMATCH,       
//             DISP=(NEW,CATLG,DELETE),             
//             UNIT=SYSDA,                         
//             SPACE=(CYL,(1,1),RLSE),             
//             DCB=(RECFM=FB,LRECL=46,BLKSIZE=0)   
//SYSIN    DD *                                     
  JOINKEYS FILES=F1,FIELDS=(1,17,A)                 
  JOINKEYS FILES=F2,FIELDS=(1,17,A)                 
  REFORMAT FIELDS=(F1:1,45),FILL=X'FF'             
  SORT FIELDS=COPY                                 
  JOIN UNPAIRED                                     
  OUTFIL FNAMES=ONLYF2,INCLUDE=(01,01,BI,EQ,X'FF')   
  OUTFIL FNAMES=MATCH,SAVE                         
/*     


Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
davinski.bby
Beginner


Joined: 30 Jul 2007
Posts: 31
Topics: 10

PostPosted: Tue Aug 21, 2007 10:27 am    Post subject: Reply with quote

Hi Kolusu,

I used this jcl. I just would like to get the records in input1 that has no match in input 2.
Code:


//STEP0100 EXEC PGM=SORT                           
//SYSOUT   DD SYSOUT=*                             
//SORTJNF1 DD  DSN=input1,         
//             DISP=SHR                             
//SORTJNF2 DD  DSN=input2,       
//             DISP=SHR                             
//NOMATCH  DD  DSN=input1.NOMATCH,         
//             DISP=(NEW,CATLG,DELETE),             
//             UNIT=SYSDA,                         
//             SPACE=(CYL,(1,1),RLSE)               
//SYSIN    DD *                                     
  JOINKEYS FILES=F1,FIELDS=(1,17,A)                 
  JOINKEYS FILES=F2,FIELDS=(1,17,A)                 
  REFORMAT FIELDS=(F2:1,17),FILL=X'FF'             
  SORT FIELDS=COPY                                 
  JOIN UNPAIRED                                     
  OUTFIL FNAMES=NOMATCH,INCLUDE=(01,01,BI,EQ,X'FF'),
/*                                                 



based on my input, i know that there are 3 records non-matching records. I get the 3 records in the output but they are all spaces.

Please let me know what i did wrong.

Thanks.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Aug 21, 2007 10:43 am    Post subject: Reply with quote

Quote:

I used this jcl. I just would like to get the records in input1 that has no match in input 2.

davinski.bby,

*sigh* try this jcl

Code:

//STEP0100 EXEC PGM=SORT
//SYSOUT   DD SYSOUT=*
//SORTJNF1 DD  DSN=input1,
//             DISP=SHR
//SORTJNF2 DD  DSN=input2,
//             DISP=SHR
//SORTOUT  DD  DSN=input1.NOMATCH,
//             DISP=(NEW,CATLG,DELETE),
//             UNIT=SYSDA,
//             SPACE=(CYL,(1,1),RLSE)
//SYSIN    DD *
  JOINKEYS FILES=F1,FIELDS=(1,17,A)
  JOINKEYS FILES=F2,FIELDS=(1,17,A)
  REFORMAT FIELDS=(F2:1,17)
  SORT FIELDS=COPY
  JOIN UNPAIRED,F1,ONLY
/*                     


Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
davinski.bby
Beginner


Joined: 30 Jul 2007
Posts: 31
Topics: 10

PostPosted: Tue Aug 21, 2007 3:56 pm    Post subject: Reply with quote

thanks kolusu. will do better next time. thanks again.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group