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
 

 

Match 2 files with record lengths of 68 and 366

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
eytellene

New User


Joined: 19 May 2009
Posts: 16
Location: Philippines

PostPosted: Mon Jun 15, 2009 3:46 pm    Post subject: Match 2 files with record lengths of 68 and 366
Reply with quote

Hi Masters,

I have 2 input files with record lengths of 68 and 366 respectively. I want to get all the details with mathcing number key located in the first position with 13 bytes length and unmatching number key.

The match output file must be formatted to 26 record length and will only contain number key (pos 1, length 13-- in file 1), number (pos 14, length 10 -- in file 1) and quantity (pos 60, length 3 -- in file 2)

Input file1

111111111111106/15/20092222222222
333333333333306/15/20092222222222
444444444444406/15/20092222222222
555555555555506/15/20092222222222

Input File2:
111111111111106/15/20092222222222 444
222222222222206/15/20092222222222 555
333333333333306/15/20092222222222 111
444444444444406/15/20092222222222 222

JCL:

//STEP1 EXEC PGM=SORT
//SORTJNF1 DD DSN=WXX220.INPUT.FILE1,DISP=SHR
//SORTJNF2 DD DSN=WXX220.INPUT.FILE2,DISP=SHR
//****
//SORTOF01 DD DSN=WXX220.UNMATCH.FILE,
// DISP=(NEW,CATLG,DELETE),
// DCB=(DSORG=PS,RECFM=FB,LRECL=26),
// DATACLAS=STANDARD
//SORTOF02 DD DSN=WXX220.MATCHED.FILE,
// DISP=(NEW,CATLG,DELETE),
// DCB=(DSORG=PS,RECFM=FB,LRECL=26),
// DATACLAS=STANDARD
//SORTWK01 DD UNIT=SYSDA,SPACE=(CYL,(50,10),RLSE)
//SORTWK02 DD UNIT=SYSDA,SPACE=(CYL,(50,10),RLSE)
//SORTWK03 DD UNIT=SYSDA,SPACE=(CYL,(50,10),RLSE)
//SORTWK04 DD UNIT=SYSDA,SPACE=(CYL,(50,10),RLSE)
//SORTWK05 DD UNIT=SYSDA,SPACE=(CYL,(50,10),RLSE)
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSIN DD *
JOINKEYS FILES=F1,FIELDS=(01,13,A)
JOINKEYS FILES=F2,FIELDS=(01,13,A)
REFORMAT FIELDS=(F1:1,68,F2:1,366),FILL=X'FF'
JOIN UNPAIRED
SORT FIELDS=COPY
OUTFIL FILES=01,INCLUDE=(69,1,BI,EQ,X'FF'),
OUTREC=(1,13,14,10)
OUTFIL FILES=01,INCLUDE=(1,1,BI,EQ,X'FF'),
OUTREC=(69,13,82,14)
OUTFIL FILES=02,INCLUDE=(1,1,BI,NE,X'FF',AND,69,1,BI,NE,X'FF')
OUTREC=(1,13,14,10,24,10,129,3)
/*

Error:

SYNCSORT FOR Z/OS 1.2.3.0R U.S. PATENTS: 4210961, 5117495 (C) 20
[COMPANY NAME] z/OS
PRODUCT LICENSED FOR CPU SERIAL NUMBER xxxxx, MODEL 2097 605
SYSIN :
JOINKEYS FILES=F1,FIELDS=(01,13,A)
JOINKEYS FILES=F2,FIELDS=(01,13,A)
REFORMAT FIELDS=(F1:1,68,F2:1,366),FILL=X'FF'
JOIN UNPAIRED
SORT FIELDS=COPY
OUTFIL FILES=01,INCLUDE=(69,1,BI,EQ,X'FF'),
OUTREC=(1,13,14,10)
OUTFIL FILES=01,INCLUDE=(1,1,BI,EQ,X'FF'),
OUTREC=(69,13,82,14)
OUTFIL FILES=02,INCLUDE=(1,1,BI,NE,X'FF',AND,69,1,BI,NE,X'FF')
OUTREC=(1,13,14,10,24,10,129,3)
*
WER268A OUTREC STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE

Can anyone help me how come syntax error in OUTREC?

Thanks icon_smile.gif
Back to top
View user's profile Send private message

expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Mon Jun 15, 2009 3:56 pm    Post subject:
Reply with quote

try changing
Code:

OUTFIL FILES=02,INCLUDE=(1,1,BI,NE,X'FF',AND,69,1,BI,NE,X'FF')
OUTREC=(1,13,14,10,24,10,129,3)

to
Code:

OUTFIL FILES=02,INCLUDE=(1,1,BI,NE,X'FF',AND,69,1,BI,NE,X'FF'),
OUTREC=(1,13,14,10,24,10,129,3)
Back to top
View user's profile Send private message
Alissa Margulies

SYNCSORT Support


Joined: 25 Jul 2007
Posts: 500
Location: USA

PostPosted: Mon Jun 15, 2009 9:41 pm    Post subject:
Reply with quote

eytellene,

As expat pointed out, you are missing a comma after your INCLUDE statement. If you are still encountering a problem after adding the comma, please let us know.
Back to top
View user's profile Send private message
eytellene

New User


Joined: 19 May 2009
Posts: 16
Location: Philippines

PostPosted: Tue Jun 16, 2009 8:18 am    Post subject:
Reply with quote

Hi expat and Alice,

Thanks... but a different error occured

STEP1 , -SORTOF01 DUPLICATE OUTFIL SPECIFICATION

Isn't it possible to declare 2 OUTFILS? Since I want all the unmatched details from both file 1 and file 2 to be outputed in the unmatched output file?

icon_smile.gif
Back to top
View user's profile Send private message
mfsundar

New User


Joined: 05 Apr 2009
Posts: 7
Location: India

PostPosted: Tue Jun 16, 2009 4:06 pm    Post subject:
Reply with quote

Try the below code

Code:
SORT     EXEC PGM=SORT                                       
SYSUDUMP  DD SYSOUT=D                                       
SYSSRT    DD SYSOUT=J                                       
SYSOUT    DD SYSOUT=J                                       
SORTWK01  DD SPACE=(CYL,(80),RLSE),UNIT=SYSDA               
SORTWK02  DD SPACE=(CYL,(80),RLSE),UNIT=SYSDA               
SORTWK03  DD SPACE=(CYL,(80),RLSE),UNIT=SYSDA               
SORTJNF1  DD DSN=XXXXXX.INPUT.FILE1,DISP=SHR               
SORTJNF2  DD DSN=XXXXXX.INPUT.FILE2,DISP=SHR               
SORTOF01  DD DSN=XXXXXX.UNMATCH.FILE,                       
   DISP=(NEW,CATLG,DELETE),                                 
   UNIT=SYSDA,                                               
   SPACE=(0,(1,10),RLSE),                                   
   DCB=(RECFM=FB,LRECL=27,BLKSIZE=0)                         
SORTOF02  DD DSN=XXXXXX.MATCHED.FILE,                       
   DISP=(NEW,CATLG,DELETE),                                 
   UNIT=SYSDA,                                               
   SPACE=(0,(1,10),RLSE),                                   
   DCB=(RECFM=FB,LRECL=36,BLKSIZE=0)                         
SORTOUT   DD SYSOUT=J                                       
SYSIN DD *                                                   
 JOINKEYS FILES=F1,FIELDS=(01,13,A)                         
 JOINKEYS FILES=F2,FIELDS=(01,13,A)                         
 JOIN UNPAIRED                                               
 REFORMAT FIELDS=(F1:1,68,F2:1,366),FILL=X'FF'               
 SORT FIELDS=COPY                                           
 OUTFIL FILES=01,                                           
        IFTHEN=(WHEN=(1,1,BI,EQ,X'FF'),                     
                 BUILD=(1:69,13,14:82,14)),                 
        IFTHEN=(WHEN=(69,1,BI,EQ,X'FF'),                     
                 BUILD=(1:1,13,14:14,10)),                   
        IFTHEN=(WHEN=NONE,BUILD=(1:27X)),                   
        OMIT=(1,1,BI,NE,X'FF',AND,69,1,BI,NE,X'FF')         
 OUTFIL FILES=02,                                           
        IFTHEN=(WHEN=(1,1,BI,NE,X'FF',AND,69,1,BI,NE,X'FF'),
        BUILD=(1:1,13,14:14,10,24:24,10,34:129,3)),         
        IFTHEN=(WHEN=NONE,BUILD=(1:36X)),                   
        OMIT=(1,1,BI,EQ,X'FF',OR,69,1,BI,EQ,X'FF')   
/*       


It works fine for me. Test with your sample data and let me know.
Back to top
View user's profile Send private message
eytellene

New User


Joined: 19 May 2009
Posts: 16
Location: Philippines

PostPosted: Tue Jun 16, 2009 5:32 pm    Post subject:
Reply with quote

Hi mfsundar,

I have copied your sysin yet syntax error occured

error:

SYNCSORT FOR Z/OS 1.2.3.0R U.S. PATENTS: 4210961, 5117495 (C)
[COMPANY NAME] z
PRODUCT LICENSED FOR CPU SERIAL NUMBER xxxxx, MODEL 2097 603
SYSIN :
JOINKEYS FILES=F1,FIELDS=(01,13,A)
JOINKEYS FILES=F2,FIELDS=(01,13,A)
JOIN UNPAIRED
REFORMAT FIELDS=(F1:1,68,F2:1,366),FILL=X'FF'
SORT FIELDS=COPY
OUTFIL FILES=01,
IFTHEN=(WHEN=1,1,BI,EQ,X'FF'),
*
BUILD=(1:69,13,14:82,14)),
IFTHEN=(WHEN=69,1,BI,EQ,X'FF'),
*
BUILD=(1:1,13,14:14,10)),
IFTHEN=(WHEN=NONE,BUILD=1:26X)),
OMIT=(1,1,BI,NE,X'FF',AND,69,1,BI,NE,X'FF')
OUTFIL FILES=02,
IFTHEN=(WHEN=1,1,BI,NE,X'FF',AND,69,1,BI,NE,X'FF'),
*
BUILD=(1:1,13,14:14,10,24:24,10,34:129,3)),
IFTHEN=(WHEN=NONE,BUILD=1:26X)),
OMIT=(1,1,BI,EQ,X'FF',OR,69,1,BI,EQ,X'FF')
WER268A OUTFIL STATEMENT : SYNTAX ERROR
WER270A OUTFIL STATEMENT : DUPLICATE PARM FOUND
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE

Did I miss out something? icon_sad.gif
Back to top
View user's profile Send private message
mfsundar

New User


Joined: 05 Apr 2009
Posts: 7
Location: India

PostPosted: Tue Jun 16, 2009 7:00 pm    Post subject:
Reply with quote

Yes, you missed the braces after "WHEN=" in three statements. To avoid confusion please copy and paste from my code and then execute the job.
Back to top
View user's profile Send private message
eytellene

New User


Joined: 19 May 2009
Posts: 16
Location: Philippines

PostPosted: Wed Jun 17, 2009 7:57 am    Post subject:
Reply with quote

hi mfsundar,

Thanks icon_smile.gif

The JCL worked fine yet the unmatch output file 1 has records in the 24th to 27th position

222222222222206/15/20092222
555555555555506/15/2009

I just wanted its output file to be

222222222222206/15/2009
555555555555506/15/2009

I have changed its length to 23, yet its having ann error of incompatible length.

error:
JOINKEYS REFORMAT RECORD LENGTH= 434, TYPE = F
SORTOF01 : RECFM=FB ; LRECL= 23; BLKSIZE= 27991
SORTOF02 : RECFM=FB ; LRECL= 36; BLKSIZE= 27972
SORTOF01 HAS INCOMPATIBLE LRECL
SYNCSMF CALLED BY SYNCSORT; RC=0000
SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
JNF1 STATISTICS
2,564K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
0 BYTES RESERVE REQUESTED, 1,016K BYTES USED
SORTJNF1 : RECFM=FB ; LRECL= 68; BLKSIZE= 27948
JNF2 STATISTICS
2,564K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
0 BYTES RESERVE REQUESTED, 1,016K BYTES USED
SORTJNF2 : RECFM=FB ; LRECL= 366; BLKSIZE= 27816


Thanks in advance icon_smile.gif
Back to top
View user's profile Send private message
mfsundar

New User


Joined: 05 Apr 2009
Posts: 7
Location: India

PostPosted: Wed Jun 17, 2009 8:33 am    Post subject:
Reply with quote

It is ok for record length changed to 23. Also you should change "BUILD" statement of first "IFTHEN" for "FILES=01" like below code

change from

Code:
OUTFIL FILES=01,                                           
           IFTHEN=(WHEN=(1,1,BI,EQ,X'FF'),                     
                        BUILD=(1:69,13,14:82,14)), 


to

Code:
OUTFIL FILES=01,                                           
           IFTHEN=(WHEN=(1,1,BI,EQ,X'FF'),                     
                        BUILD=(1:69,13,14:82,10)),


This code change is satisfy your requirement.

Previously i coded "BUILD=(1:69,13,14:82,14)", because you mentioned in the jcl as

Quote:
OUTFIL FILES=01,INCLUDE=(1,1,BI,EQ,X'FF'),
OUTREC=(69,13,82,14)


sorry for the confusion.
Back to top
View user's profile Send private message
mfsundar

New User


Joined: 05 Apr 2009
Posts: 7
Location: India

PostPosted: Wed Jun 17, 2009 8:41 am    Post subject:
Reply with quote

Sorry i missed another one. You should also change along with my previous post in the "BUILD" statement of last "IFTHEN" for "FILES=01" like below code

from
Code:
IFTHEN=(WHEN=NONE,BUILD=(1:27X)),


to
Code:
IFTHEN=(WHEN=NONE,BUILD=(1:23X)),


Please let me know it's work fine or not.
Back to top
View user's profile Send private message
eytellene

New User


Joined: 19 May 2009
Posts: 16
Location: Philippines

PostPosted: Wed Jun 17, 2009 2:51 pm    Post subject:
Reply with quote

Okay thanks a lot icon_smile.gif
Back to top
View user's profile Send private message
mfsundar

New User


Joined: 05 Apr 2009
Posts: 7
Location: India

PostPosted: Wed Jun 17, 2009 4:40 pm    Post subject:
Reply with quote

You are welcome...
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Wed Jun 17, 2009 8:46 pm    Post subject:
Reply with quote

eytellene,

If I got your requirement right, you dont really need this many IFTHENs. Here's a simplified SyncSort job to achieve this.
Code:
//STEP0100 EXEC PGM=SORT                                             
//SYSOUT   DD SYSOUT=*                                               
//SORTJNF1 DD DSN=  Input-1  (FB/68)                                 
//SORTJNF2 DD DSN=  Input-2  (FB/366)                                 
//MATCH    DD DSN=  Output-1 (FB/26)                                 
//NOMATCH  DD DSN=  Output-2 (FB/23)                                 
//SYSIN    DD *                                                       
  JOINKEYS FILE=F1,FIELDS=(1,13,A)                                   
  JOINKEYS FILE=F2,FIELDS=(1,13,A)                                   
  SORT FIELDS=COPY                                                   
  JOIN UNPAIRED                                                       
  REFORMAT FIELDS=(F1:1,23,F2:1,23,F2:60,3),FILL=X'FF'               
  OUTFIL FNAMES=NOMATCH,INCLUDE=(1,1,CH,EQ,X'FF',OR,24,1,CH,EQ,X'FF'),
         IFTHEN=(WHEN=(1,1,CH,EQ,X'FF'),BUILD=(24,23)),               
         IFTHEN=(WHEN=NONE,BUILD=(1,23))                             
  OUTFIL FNAMES=MATCH,SAVE,BUILD=(1,23,47,3)
MATCH
Code:
111111111111106/15/2009444
333333333333306/15/2009111
444444444444406/15/2009222
NOMATCH
Code:
222222222222206/15/2009
555555555555506/15/2009
Back to top
View user's profile Send private message
eytellene

New User


Joined: 19 May 2009
Posts: 16
Location: Philippines

PostPosted: Thu Jun 18, 2009 8:40 am    Post subject:
Reply with quote

Hi arcvns,

I have tried the JCL, but I am encountering a syntax error. Did I miss out anything? icon_sad.gif

Error:

SYSIN :
JOINKEYS FILES=F1,FIELDS=(01,12,A,13,10,A)
JOINKEYS FILES=F2,FIELDS=(01,12,A,13,10,A)
SORT FIELDS=COPY
JOIN UNPAIRED
REFORMAT FIELDS=(F1:1,23,F2:1,23,F2:60,3),FILL=X'FF'
OUTFIL FNAMES=NOMATCH,INCLUDE=
*
(1,1,CH,EQ,X'FF',OR,24,1,CH,EQ,X'FF'),
*
IFTHEN=(WHEN=(1,1,CH,EQ,X'FF'),BUILD=(24,23)),
*
IFTHEN=(WHEN=NONE,BUILD=(1,23))
*
OUTFIL FNAMES=MATCH,SAVE,BUILD=(1,23,47,3)
WER268A OUTFIL STATEMENT : SYNTAX ERROR
WER275A NO KEYWORDS FOUND ON CONTROL STATEMENT
WER275A NO KEYWORDS FOUND ON CONTROL STATEMENT
WER275A NO KEYWORDS FOUND ON CONTROL STATEMENT
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Thu Jun 18, 2009 8:46 am    Post subject:
Reply with quote

Your job have the INCLUDE statement like this. Put it in a single line as in my job or else move the 'INCLUDE=' also to the next line.
Quote:
OUTFIL FNAMES=NOMATCH,INCLUDE=
*
(1,1,CH,EQ,X'FF',OR,24,1,CH,EQ,X'FF'),
Back to top
View user's profile Send private message
r2k1984

New User


Joined: 21 Jun 2005
Posts: 69
Location: chennai

PostPosted: Thu Jun 18, 2009 7:15 pm    Post subject:
Reply with quote

YOU CAN TRY WITH SPLICE WITH ICETOOL ..

IT WILL WORK ..

THANKS
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Thu Jun 18, 2009 7:30 pm    Post subject:
Reply with quote

r2k1984 wrote:
IT WILL WORK ..
r2k1984,

If you're replying to some topic and if you are really interested in helping somebody, please try to be specific to the problem rather than throwing in something.

And turn your CAPS off in future.
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am


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