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 

Addition of 5 existing columns into a new position

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


Joined: 27 Dec 2002
Posts: 46
Topics: 15

PostPosted: Thu Jun 15, 2006 4:26 pm    Post subject: Addition of 5 existing columns into a new position Reply with quote

I have a VB file, which has 5 record formats. The record type and lengths are

Header
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Jun 15, 2006 6:08 pm    Post subject: Reply with quote

I'm going to assume the following:

1) We can identify the records types by their length (e.g. if the length is 885 bytes, it's a detail 2 record).
2) The positions you gave included the RDW in positions 1-4. So the first byte of data would have position 5, not position 1. If you didn't include the RDW, then you'll need to adjust each position by adding +4.
3) For detail 1 records, you want to overlay 783-786 with 540-543 and overlay 790-793 with the sum of the other PD fields.
4) For detail 2 records, you want to overlay 787-789 with 545-547 and overlay 790-793 with the sum of the other PD fields.
5) You don't want to change the header, trailer or extended records.

The following DFSORT job will do all of that. If any of my assumptions are wrong, you can change the job appropriately, or indicate how the assumptions are wrong.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (VB)
//SORTOUT DD DSN=...  output file (VB)
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(1,2,BI,EQ,+885),
    OVERLAY=(783:540,4,
     790:548,4,PD,ADD,556,4,PD,ADD,564,4,PD,ADD,
         572,4,PD,ADD,580,4,PD,TO=PD,LENGTH=4)),
   IFTHEN=(WHEN=(1,2,BI,EQ,+985),
    OVERLAY=(787:545,3,
     790:552,4,PD,ADD,560,4,PD,ADD,568,4,PD,ADD,
         576,4,PD,ADD,584,4,PD,TO=PD,LENGTH=4))
/*

_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Novice
Beginner


Joined: 27 Dec 2002
Posts: 46
Topics: 15

PostPosted: Fri Jun 16, 2006 10:17 am    Post subject: Reply with quote

Hi Frank,

Thanks for the response. The records can be Identified by the record type which is a PD field at Position 10( 1 indicates Detail record 1 and 2 indicates detail record 2). Sorry for not mentioning this before .
As far as your other assumption is concerned, I didn't add RDW field ( The positions mentioned are based on copybook layout). Based on these I changed the JCL in the following way
Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (VB)
//SORTOUT DD DSN=...  output file (VB)
//SYSIN    DD    *
  OPTION COPY
  INREC IFTHEN=(WHEN=(14,1,PD,EQ,1),
    OVERLAY=(787:544,4,
     794:552,4,PD,ADD,560,4,PD,ADD,568,4,PD,ADD,
         576,4,PD,ADD,584,4,PD,TO=PD,LENGTH=4)),
   IFTHEN=(WHEN=(14,1,PD,EQ,2),
    OVERLAY=(791:549,3,
     794:556,4,PD,ADD,564,4,PD,ADD,572,4,PD,ADD,
         580,4,PD,ADD,588,4,PD,TO=PD,LENGTH=4))
/*

But my result is not as expected. I am getting zeroes in the new fields. Is there any thing wrong which I did ? Could you please let me know

Thanks
Novice
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Jun 16, 2006 11:06 am    Post subject: Reply with quote

Quote:
I am getting zeroes in the new fields.


When I run your job with test input data similar to what you described, I get valid PD values greater than 0. So either your PD values are all zeros (X'0000000C') or your data doesn't look the way you described it. To see how the relevant fields in your input data really look (in hex), you can run this DFSORT job:

Code:

//SHOWVI EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN  DD DSN=...  input file
//SORTOUT DD SYSOUT=*
//SYSIN    DD    *
  OPTION COPY
  INCLUDE COND=(1,2,BI,GE,+600)
  INREC BUILD=(1,4,14,1,HEX,X,544,4,HEX,X,548,4,HEX,X,
   552,4,HEX,X,556,4,HEX,X,560,4,HEX,X,564,4,HEX,X,
   568,4,HEX,X,572,4,HEX,X,576,4,HEX,X,580,4,HEX,X,
   588,4,HEX)
/*


When I ran this job against my test input data, I got this:

Code:

 1C 0000010C 40404040 0000020C 40404040 0000030C 40404040  ...
 2C 40404040 0000011C 40404040 0000021C 40404040 0000031C  ...


You can see that record type 1 (1C) and 2 (2C) each have valid PD values > 0 where they're supposed to have them.

I suspect when you run this job against your input data, you'll discover that the PD fields are either all zeros or not where you said they were. The output should help you figure out where your PD fields actually are so you can specify the correct positions in your job.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Novice
Beginner


Joined: 27 Dec 2002
Posts: 46
Topics: 15

PostPosted: Fri Jun 16, 2006 1:38 pm    Post subject: Reply with quote

Thanks Frank. I could see the position was incorrect. Thanks for your Help and I could see the SORT solution working.

Novice
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Fri Jun 16, 2006 2:29 pm    Post subject: Reply with quote

Glad I could help.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
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