IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Hex count insertion at footer


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Wed Jul 15, 2009 8:39 pm
Reply with quote

Hi,

I have a scenario like i need to update the trailer count in hex decimal format

My output trailer record looks like
Code:
  002468  &  M  °É<T 0   
 002469 0090714M  Ìì 
  002470 0090714M    2469
 


We wrote a JCL to insert a new trailer record ( 002470 0090714M 2469). But it's inserting the count as character. Please see the sample SORT CARD below

Code:
SORT FIELDS=COPY                                                   
OUTFIL REMOVECC,                                                   
TRAILER1=(1:X'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF', 
         26:X'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF', 
         51:X'FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF',         
         72:C'20090714M',                                           
         81:COUNT),OUTREC=(1,2000)                                 
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Jul 15, 2009 10:01 pm
Reply with quote

Quote:
I have a scenario like i need to update the trailer count in hex decimal format


This is a meaningless statement. All values can be represented in hex format. For example 2469 in character format is X'F2F4F6F9', 2469 in packed decimal format is X'02469C' and 2469 in binary format is X'09A5'. So first you have to tell us what you want the count of 2469 to look like in hex.
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Thu Jul 16, 2009 12:14 am
Reply with quote

Frank,

I am sorry to confuse you on this. The scenario is, We have a GDG and we filter the header and trailer record. and sort only required account number.

Now in the trailer record we have the total count which is the total count of GDG records. Right now i am updating the trailer count manually by making HEX ON and changin the record count as per the count in my sorted file.

I need to make that change thru JCL here. Please advice.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Jul 16, 2009 1:14 am
Reply with quote

You haven't answered my question, so I still can't help you.

Quote:
But it's inserting the count as character.


When you use COUNT in TRAILER1, it gives you a character count of 8 digits, right-justified with leading zeros suppressed. For example, a count of 2469 would be output as ' 2469' which in hexadecimal is X'40404040F2F4F6F9'. Apparently that's not what you want in the output record, but you haven't told me what you do want in the output record.

Quote:
Right now i am updating the trailer count manually by making HEX ON and changin the record count as per the count in my sorted file.


And what does the record count look like after you change it manually with HEX ON? If you tell me that, I can probably figure out what format you want the count in and help you. Without that information, I still don't know what you want.
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Thu Jul 16, 2009 2:23 am
Reply with quote

Frank,

I use to open the file after sorting and give hex on in the command prompt I will see as below

Code:
000020 0090331M 
       FFFFFFFD00240
       009033140002C


Here 20420 is the total GDG count.
Now the record count is 20 so i will change the total count as

Code:
000020 0090331M 
       FFFFFFFD00000
       009033140002C


This is what i want to do thru JCL. I need to update the hex value in the trailercount. Please let me know if i am still not clear.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Jul 16, 2009 2:43 am
Reply with quote

Ah, clarity at last. You want a 5-byte PD value for the count (e.g. X'000000020C'). You can change your OUTFIL statement to the following for that:

Code:

  OUTFIL REMOVECC,                     
   TRAILER1=(1:25X'FF',                 
            26:25X'FF',                 
            51:21X'FF',                 
            72:C'20090714M',           
            81:COUNT=(TO=PD,LENGTH=5)),
   BUILD=(1,2000)                       
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Thu Jul 16, 2009 3:27 am
Reply with quote

Frank,

You are always perfect!

Now i got two questions with you,

1. When i run the JCL with this sort card, it's creating a new trailer record instead of updating the existing trailer record. Is it like we cant update and only insert is possible?

2. In 72:C'20090714M', 20090714 is dynamic. To be more trailer date comes from the GDG. How do we give the dynamic sort card here?
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Jul 16, 2009 3:35 am
Reply with quote

Quote:
We wrote a JCL to insert a new trailer record


I just modified your control statements that do this.

Quote:
1. When i run the JCL with this sort card, it's creating a new trailer record instead of updating the existing trailer record. Is it like we cant update and only insert is possible?

2. In 72:C'20090714M', 20090714 is dynamic. To be more trailer date comes from the GDG. How do we give the dynamic sort card here?


I can't read your mind. You have to give me the information I need to help you.

1. If you want to update the existing trailer record, you need to tell me what the existing trailer record looks like and what the new trailer record should look like. Which fields from the existing trailer record do you want to keep? Which fields do you want to update? What's in those fields?

2. What do you mean "trailer date comes from the GDG"? Is it in a record in the GDG? If so, how can that record and field be identified and what does it look like? If the date is somewhere else, explain exactly where it is. Is the date by any chance the current date or the current date plus or minus some number of days? Or is it something hardcoded? Be specific.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Jul 16, 2009 3:35 am
Reply with quote

k.a.khamaurutheen,

Are there anymore MINOR little changes that you have forgotten to mention?
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Fri Jul 17, 2009 12:12 am
Reply with quote

Frank,

We wanted to keep all the field values in trailer record except up that we want to update the count of records in trailer record. From 81th byte of trailer record we have 5 bytes of packed value to be populated for count of records.
Code:
 OUTFIL REMOVECC,                     
   TRAILER1=(1:71X'FF',   
            72:C'20090714M',           
            81:COUNT=(TO=PD,LENGTH=5)),
   BUILD=(1,2000) 
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Fri Jul 17, 2009 12:41 am
Reply with quote

Let's start over. Show me an example of the records in your input file (relevant fields only) and what you expect for the output records. If there's something in the trailer record that distinguishes it from the other records in the file, tell me what that is (e.g. X'FF' in position 1). Tell me the RECFM and LRECL of the input file.
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Fri Jul 17, 2009 2:53 am
Reply with quote

frank,

it's different from other records where the first 72 bytes has the high values.

I shall try to pull you the example from our file soon.
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Sat Jul 18, 2009 1:13 am
Reply with quote

Frank,

My records look like below

Code:
B0  M  °É<T 0                    °É<  °É@0S1985D1  °É< rd 341268
          M  °É<1nitel retail cord A95-208 KAPONOE PLACE
00  &  M  °É<T 0                    °É<  °É@1S29G001  °É< Ê @T40550
          M  °É<3 commercial bank FTP K3 LL
01  &  M  °É<T 0                    °É<  °É@0S19F006  °É< p/ V04586
  20090714M  Ìì 


I just copied from 68th position to 130 th position.

Please let me know if ay more info req
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Sat Jul 18, 2009 2:20 am
Reply with quote

khamarutheen,

The following DFSORT JCL will give you the desired results. The job assumes that only the trailer record will have x'ff' in the first 71 bytes


Code:

//STEP0100 EXEC PGM=SORT                                   
//SYMNAMES DD *                                             
TVAL,X'FFFFFFFFFFFFFFFFFFFF'                               
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD DSN=your input file,DISP=SHR
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                             
  SORT FIELDS=COPY                                         
  INREC IFOUTLEN=2000,                                     
  IFTHEN=(WHEN=INIT,OVERLAY=(2001:SEQNUM,5,PD)),           
  IFTHEN=(WHEN=(01,10,CH,EQ,TVAL,AND,11,10,CH,EQ,TVAL,AND, 
                21,10,CH,EQ,TVAL,AND,31,10,CH,EQ,TVAL,AND, 
                41,10,CH,EQ,TVAL,AND,51,10,CH,EQ,TVAL,AND, 
                61,10,CH,EQ,TVAL,AND,71,01,CH,EQ,X'FF'),   
  OVERLAY=(81:2001,5))                                     
/*
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Tue Jul 21, 2009 3:24 am
Reply with quote

Kolusu,

Thanks for your help! But still it's not working. I dont see any updation in my output file!
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Tue Jul 21, 2009 3:28 am
Reply with quote

FYI,

O/P record is showing like

Code:
------------------------------------------------------------------------------
=COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+----7--
002469  2
       FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
       FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2
------------------------------------------------------------------------------
--------------------------------------------------------------------
--+----8----+----9----+----0----+----1----+----2----+----3----+----4-
0090714M  Ìì 
FFFFFFFD00752FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
009071440088CFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
--------------------------------------------------------------------


Except that it should show like


Code:
7----+----8----+-
  20090714M  Ìì 
FFFFFFFFFFD00049F
FF2009071440026CF


2469 is the total count of the output file
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Jul 21, 2009 3:31 am
Reply with quote

khamarutheen,

The job will ONLY update the record if the first 71 bytes are x'FF' . Are you sure that your first 71 bytes are x'FF' for the trailer record?
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Tue Jul 21, 2009 3:32 am
Reply with quote

Please see the output above kolusu and let me know if anything more info required.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Jul 21, 2009 3:39 am
Reply with quote

khamarutheen,

Another Important Q is your input a VB file? If so you need to account for RDW
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Tue Jul 21, 2009 3:56 am
Reply with quote

FYI,

Code:

Organization  . . . : PS   
Record format . . . : FB   
Record length . . . : 2000
Block size  . . . . : 18000
1st extent megabytes: 4   
Secondary megabytes : 40 
 
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Jul 21, 2009 4:14 am
Reply with quote

khamaurutheen,

The posted job works fine for me . If you say it is not working then I need to see your control cards and the sysout messages.
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Tue Jul 21, 2009 9:16 pm
Reply with quote

Please see my sysout.

Code:
PROCESSING SYMNAMES STATEMENTS                                               
ORIGINAL STATEMENTS FROM SYSIN    FOLLOW                                     
  SORT FIELDS=COPY                                                           
  INREC IFOUTLEN=2000,                                                       
  IFTHEN=(WHEN=INIT,OVERLAY=(2001:SEQNUM,5,PD)),                             
  IFTHEN=(WHEN=(01,10,CH,EQ,TVAL,AND,11,10,CH,EQ,TVAL,AND,                   
                21,10,CH,EQ,TVAL,AND,31,10,CH,EQ,TVAL,AND,                   
                41,10,CH,EQ,TVAL,AND,51,10,CH,EQ,TVAL,AND,                   
                61,10,CH,EQ,TVAL,AND,71,01,CH,EQ,X'FF'),                     
  OVERLAY=(81:2001,5))                                                       
PERFORMING SYMBOL SUBSTITUTION AS NEEDED                                     
BLOCKSET     COPY  TECHNIQUE SELECTED                                         
VISIT http://www.ibm.com/storage/dfsort FOR DFSORT PAPERS, EXAMPLES AND MORE 
- CONTROL STATEMENTS FOR 5694-A01, Z/OS DFSORT V1R10 - 11:43 ON TUE JUL 21, 20
 SORT FIELDS=COPY                                                             
 INREC IFOUTLEN=2000,IFTHEN=(WHEN=INIT,OVERLAY=(2001:SEQNUM,5,PD)),IFTH*     
               EN=(WHEN=(01,10,CH,EQ,X'FFFFFFFFFFFFFFFFFFFF',AND,11,10,*     
               CH,EQ,X'FFFFFFFFFFFFFFFFFFFF',AND,21,10,CH,EQ,X'FFFFFFFF*     
  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
 FFFFFFFFFFFF',AND,31,10,CH,EQ,X'FFFFFFFFFFFFFFFFFFFF',AN*   
 D,41,10,CH,EQ,X'FFFFFFFFFFFFFFFFFFFF',AND,51,10,CH,EQ,X'*   
 FFFFFFFFFFFFFFFFFFFF',AND,61,10,CH,EQ,X'FFFFFFFFFFFFFFFF*   
 FFFF',AND,71,01,CH,EQ,X'FF'),OVERLAY=(81:2001,5))           


OUTPUT LRECL = 2000, BLKSIZE = 18000, TYPE = FB
INSERT 0, DELETE 0
RECORDS - IN: 2469, OUT: 2469
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Tue Jul 21, 2009 10:26 pm
Reply with quote

khamarutheen,

I don't see any thing obvious that would pinpoint as to why it does not work for you. Run this job and see how many records you got in your sortout dataset.

Code:

//STEP0100 EXEC PGM=SORT                                   
//SYMNAMES DD *                                           
TVAL,X'FFFFFFFFFFFFFFFFFFFF'                               
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD DSN=Your input file,DISP=SHR
//SORTOUT  DD SYSOUT=*                                     
//SYSIN    DD *                                           
  SORT FIELDS=COPY                                         
  INCLUDE COND=(01,10,CH,EQ,TVAL,AND,11,10,CH,EQ,TVAL,AND,
                21,10,CH,EQ,TVAL,AND,31,10,CH,EQ,TVAL,AND,
                41,10,CH,EQ,TVAL,AND,51,10,CH,EQ,TVAL,AND,
                61,10,CH,EQ,TVAL,AND,71,01,CH,EQ,X'FF')   
/*
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Wed Jul 22, 2009 11:34 pm
Reply with quote

RECORDS - IN: 2469, OUT: 1

In sysout i can see one record has been available.
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 677
Location: NJ

PostPosted: Wed Jul 22, 2009 11:36 pm
Reply with quote

O/P file look slike below

Code:
6----+----7----+----8----+-
  20090714M  Ìì 
FFFFFFFFFFFFFFFFFFFFD00752F
FFFFFFFFFFFF2009071440088CF
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL Goto page 1, 2  Next

 


Similar Topics
Topic Forum Replies
No new posts To get the count of rows for every 1 ... DB2 3
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Validating record count of a file is ... DFSORT/ICETOOL 13
No new posts Insert header record with record coun... DFSORT/ICETOOL 14
No new posts Count the number of characters in a f... CA Products 1
Search our Forums:

Back to Top