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.
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.
You haven't answered my question, so I still can't help you.
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.
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.
I just modified your control statements that do this.
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.
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.
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.