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 

DFSORT handling VB files with joinkey

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


Joined: 21 Jun 2014
Posts: 259
Topics: 54

PostPosted: Fri Sep 19, 2014 3:40 pm    Post subject: DFSORT handling VB files with joinkey Reply with quote

Hi,

I am little confused with VB to FB conversion in dfsort with joinkeys.

I need matched and unmatched record of F1 with recl 9004 in VB format.


Code I tried given below , Please advice.
Code:

//S1   EXEC  PGM=SORT                                       
//SYSOUT DD SYSOUT=*                                       
//SORTJNF1 DD DISP=SHR,DSN=File1    VB/9004
//SORTJNF2 DD DISP=SHR,DSN=File2    FB/40
//MATCH    DD DSN=File1(+1),             
//            DISP=(NEW,CATLG,DELETE),                     
//            UNIT=CART,VOL=(,,,99),                       
//            DCB=(xyz.model,RECFM=VB,LRECL=9004,BUFNO=60)   
//UNMATCH  DD DSN=File3,               
//            DISP=(NEW,CATLG,DELETE),                     
//            UNIT=CART,VOL=(,,,99),                       
//            DCB=(xyz.model,RECFM=VB,LRECL=9004,BUFNO=60)   
//SYSIN DD *                                               
* CONTROL STATEMENTS FOR JOINKEYS APPLICATION               
   JOINKEYS FILE=F1,FIELDS=(5,29,A),SORTED,NOSEQCK         
   JOINKEYS FILE=F2,FIELDS=(1,29,A)                         
   JOIN UNPAIRED,F1                                         
   REFORMAT FIELDS=(F1:5,9000,?)                           
* CONTROL STATEMENTS FOR MAIN TASK (JOINED RECORDS)         
CONTROL STATEMENTS FOR MAIN TASK (JOINED RECORDS)                     
 SORT FIELDS=COPY                                                     
 OUTFIL FNAMES=MATCH,INCLUDE=(9001,1,CH,EQ,C'B'),FTOV,BUILD=(1,9004) 
 OUTFIL FNAMES=UNMATCH,INCLUDE=(9001,1,CH,EQ,C'1'),                   
 FTOV,BUILD=(1,9004)


Thanks
Magesh
Back to top
View user's profile Send private message
Magesh_J
Intermediate


Joined: 21 Jun 2014
Posts: 259
Topics: 54

PostPosted: Fri Sep 19, 2014 3:51 pm    Post subject: Reply with quote

Tried changing this way, it looks it works.
Code:

//SYSIN DD *                                                   
* CONTROL STATEMENTS FOR JOINKEYS APPLICATION                 
   JOINKEYS FILE=F1,FIELDS=(5,29,A),SORTED,NOSEQCK             
   JOINKEYS FILE=F2,FIELDS=(1,29,A)                           
   JOIN UNPAIRED,F1                                           
   REFORMAT FIELDS=(F1:5,9000,?)                               
* CONTROL STATEMENTS FOR MAIN TASK (JOINED RECORDS)           
   SORT FIELDS=COPY                                           
   OUTFIL FNAMES=MATCH,INCLUDE=(9001,1,CH,EQ,C'B'),FTOV,       
   OUTREC=(1,9000)                                             
   OUTFIL FNAMES=UNMATCH,INCLUDE=(9001,1,CH,EQ,C'1'),FTOV,     
   OUTREC=(1,9000)                                             
/*                                                             


Thanks
Magesh
Back to top
View user's profile Send private message
William Collins
Supermod


Joined: 03 Jun 2012
Posts: 437
Topics: 0

PostPosted: Sat Sep 20, 2014 1:49 am    Post subject: Reply with quote

You can take all the DCB info off your output datasets. DFSORT can supply all that for you, with no possibility of a clash if something changes (or two places to make the same change).

It may look like it works, but all your output records are 9004 bytes long. If they are full of data, why make it a V-type file? If they are not full of data, consult the documentation and see what VLTRIM on OUTFIL can do for you.

Since your two OUTFIL's are mutually exclusive, you can use SAVE instead of one of the tests.

It was not BUILD that was the problem, it was the 9004. Please change the OUTRECs back to BUILDs.

Ah. Now noting your title and your opening paragraph.

You have a V-type file and you want to add a piece if information temporarily, use it in OUTFIL to direct the processing, and then forget about it.

With variable-length records it is much better to prepend rather than append temporary data:

Code:
 REFORMAT FIELDS=(F1:1,4,?,F1:5)


That keeps the records variable (the 1,4), puts the match-marker first and then the data from position five to the end of the actual record.
Code:

 OUTFIL ...,BUILD=(1,4,6)


That recreates your original record. The lonely six does "byte six to the end of the record" and your match-marker has disappeared.
Back to top
View user's profile Send private message
Magesh_J
Intermediate


Joined: 21 Jun 2014
Posts: 259
Topics: 54

PostPosted: Mon Sep 22, 2014 8:04 am    Post subject: Reply with quote

Thanks William,

The reason why i need in vb and in a specfic format is because, The input file is an production one and we are removing some of the record from the input file. after we remove the problamatic record, we need to replace the input file with our file created. We cannot change format/layout of the file. It is has to be in the same format, only the problamtic records to be removed and the problamtic record are in File2.

Will there be any garbage bytes added since the reformat is FB ? i.e Sort read as VB and convert it to FB and i am converting again back to VB.
Because not all records are having same length, it varies.

Code:

OUTFIL FNAMES=MATCH,INCLUDE=(5,1,CH,EQ,C'B'),FTOV,VLTRIM=C' ',BUILD=(6,9000)
OUTFIL FNAMES=UNMATCH,INCLUDE=(5,1,CH,EQ,C'1'),FTOV,VLTRIM=C' ',BUILD=(6,9000)



William wrote:

OUTFIL ...,BUILD=(1,4,6)


Do we still required this 1,4 will the FTOV wont take care of it ?


Regards,
Magesh
Back to top
View user's profile Send private message
William Collins
Supermod


Joined: 03 Jun 2012
Posts: 437
Topics: 0

PostPosted: Mon Sep 22, 2014 9:58 am    Post subject: Reply with quote

The REFORMAT RECORD I showed is not fixed-length.

I wrote some stuff then looked again at your title, and then the post, so for your question, read from "Ah. Now noting your title and your opening paragraph."

The REFORMAT RECORD I showed copies the RDW, inserts the Match Marker, then copies only the data from the current variable-length record. The later BUILDs strip out the Match Marker and return the record to its original state, with its original length, and with only its original data and nothing else. You don't need the FTOV as there is no need to make it F in the first place.

Why don't you run it on a test file and see?
Back to top
View user's profile Send private message
Magesh_J
Intermediate


Joined: 21 Jun 2014
Posts: 259
Topics: 54

PostPosted: Mon Sep 22, 2014 11:08 am    Post subject: Reply with quote

I dont know, how make the join in VB, Please find the below error

Code:

          * CONTROL STATEMENTS FOR JOINKEYS APPLICATION                         
             JOINKEYS FILE=F1,FIELDS=(5,29,A),SORTED,NOSEQCK                   
             JOINKEYS FILE=F2,FIELDS=(1,29,A)                                   
             JOIN UNPAIRED,F1                                                   
             REFORMAT FIELDS=(F1:1,4,?,F1:5,9000)                               
          * CONTROL STATEMENTS FOR MAIN TASK (JOINED RECORDS)                   
             SORT FIELDS=COPY                                                   
             OUTFIL FNAMES=MATCH,INCLUDE=(5,1,CH,EQ,C'B'),                     
             BUILD=(1,4,6,9000)                                                 
             OUTFIL FNAMES=UNMATCH,INCLUDE=(5,1,CH,EQ,C'1'),                   
             BUILD=(1,4,6,9000)                                                 
ICE411I 0 THIS IS THE JOINKEYS MAIN TASK FOR JOINING F1 AND F2                 
ICE416I 0 JOINKEYS IS USING THE F1 SUBTASK FOR SORTJNF1 - SEE JNF1JMSG MESSAGES
ICE416I 1 JOINKEYS IS USING THE F2 SUBTASK FOR SORTJNF2 - SEE JNF2JMSG MESSAGES
ICE419I 0 JOINED RECORDS: TYPE=F, LENGTH=9005                                   
ICE201I H RECORD TYPE IS F - DATA STARTS IN POSITION 1                         
ICE043A 9 INVALID DATA SET ATTRIBUTES: MATCH    RECFM   - REASON CODE IS 14     
ICE751I 0 C5-K90025 C6-K90025 C7-K54603 C8-K62201 E9-K60823 E7-K62201           
ICE052I 3 END OF DFSORT                                                         


that why i am converting, Please advice.

Thanks
Magesh
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 Sep 22, 2014 11:12 am    Post subject: Reply with quote

Magesh_J,

Couple of Issues with your job.

1. Never code DCB parameters in your JCL. DFSORT is quite capable of getting the DCB info either from the input file or your BUILD statements.

2. If you want to retain the VB info you just need to specify the start position WITHOUT the length and DFSORT will produce a VB file.

3. As William mentioned you need to have the match indicator right after RDW.

Use the following Control cards

Code:

//SYSIN    DD *                                             
  JOINKEYS FILE=F1,FIELDS=(5,29,A),SORTED,NOSEQCK           
  JOINKEYS FILE=F2,FIELDS=(1,29,A)                           
  JOIN UNPAIRED,F1                                           
  REFORMAT FIELDS=(F1:1,4,?,F1:5)                           
  OPTION COPY                                               
  OUTFIL FNAMES=MATCH,INCLUDE=(5,1,CH,EQ,C'B'),BUILD=(1,4,6)
  OUTFIL FNAMES=UNMATCH,SAVE,BUILD=(1,4,6)                   
//*                                                         


Check this link for a detailed explanation of the REFORMAT statement

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICE1CA60/4.5?

The easiest way to check the lengths of Variable block files is using the following jcl.

Code:

//STEP0200 EXEC PGM=SORT                           
//SYSOUT   DD SYSOUT=*                             
//SORTIN   DD DISP=SHR,DSN=Your output Vb file                   
//SORTOUT  DD SYSOUT=*                             
//SYSIN    DD *                                   
  OPTION COPY                                     
  OUTFIL VTOF,BUILD=(1,2,BI,SUB,+4,M11,LENGTH=5)   
//*

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


Joined: 21 Jun 2014
Posts: 259
Topics: 54

PostPosted: Mon Sep 22, 2014 11:23 am    Post subject: Reply with quote

Below code works,
Please advice will there be a garbage byte added in the below code, or please advice how do we identify a garbage value is added or not ?

Code:

//SYSIN DD *                                             
* CONTROL STATEMENTS FOR JOINKEYS APPLICATION             
   JOINKEYS FILE=F1,FIELDS=(5,29,A),SORTED,NOSEQCK       
   JOINKEYS FILE=F2,FIELDS=(1,29,A)                       
   JOIN UNPAIRED,F1                                       
   REFORMAT FIELDS=(F1:1,4,?,F1:5,9000)                   
* CONTROL STATEMENTS FOR MAIN TASK (JOINED RECORDS)       
   SORT FIELDS=COPY                                       
   OUTFIL FNAMES=MATCH,INCLUDE=(5,1,CH,EQ,C'B'),FTOV,     
   BUILD=(6,9000)                                         
   OUTFIL FNAMES=UNMATCH,INCLUDE=(5,1,CH,EQ,C'1'),FTOV,   
   BUILD=(6,9000)                                         
/*                                                       


Thanks
Magesh
Back to top
View user's profile Send private message
Magesh_J
Intermediate


Joined: 21 Jun 2014
Posts: 259
Topics: 54

PostPosted: Mon Sep 22, 2014 11:37 am    Post subject: Reply with quote

Sorry Kolusu, I missed to see your reply.. Trying the same.

Thanks
Magesh
Back to top
View user's profile Send private message
Magesh_J
Intermediate


Joined: 21 Jun 2014
Posts: 259
Topics: 54

PostPosted: Tue Sep 23, 2014 6:04 am    Post subject: Reply with quote

Thanks Kolusu and William, the Code works like a charm.

Regards,
Magesh
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