Page 1 of 1

To update the trailer

PostPosted: Thu Mar 26, 2009 4:40 pm
by bodhi
I need to update the one of the trailer in the File which has record length of 220 and record format is FB. File has six headers and six trailers and in fifth header I want to remove the data then I need to update the trailer count which should be equal to the remaining record count of the record of the data in fifth header. My trailer is identify by key word TRAILER start at 1 position and count is comp-3 variable length S9 (9) COMP-3.

INPUT FILE :
HEADER
2009FI0KA E TDA73860
2009FI0KA E TDA75167
2009FI0KA G FC18
2009FI0KA K 2SA1576A
2009PP0FJ000040700000000077
2009PP0FJ000040700000000080
2009PP0FJ000040814000000069
2009PP0FJ000040814000000069
TRAILER..... ============> TRAILER COUNT IS 8

OUTPUT FILE:
HEADER
2009PP0FJ000040700000000077
2009PP0FJ000040700000000080
2009PP0FJ000040814000000069
2009PP0FJ000040814000000069
TRAILER..... ============> TRAILER COUNT SHOULD BE 4

Thanks
Bodhi

Re: To update the trailer

PostPosted: Thu Mar 26, 2009 8:57 pm
by Frank Yaeger
Huh? You say the file has six headers - in your example, which records are the six headers? You say the file has six trailers - in your example, which records are the six trailers?

I want to remove the data then I need to update the trailer count which should be equal to the remaining record count of the record of the data in fifth header.


I have no idea what you mean by this. Remove what data? What is the criteria for removing a record? "equal to the remaining record count of the record of the data in the fifth header" - what is the fifth header in your example? What do you mean by the record count of the data in the fifth header?

You need to give a much clearer description and an example that matches your description.

I suspect it's just a matter of removing records and the current trailer with OMIT, and using TRAILER1 and COUNT-n to build a new trailer. But I don't understand what you want to do so I can't show you how to do it.

Re: To update the trailer

PostPosted: Thu Mar 26, 2009 9:59 pm
by bodhi
Hi Frank,

Below is example which I think clear my requirement. Please check the fifth header in input file as well as the output file:

I need to omit the data which has 2009FI0KA at position 1 and update the fifth trailer count as well.

Input file:

HEADER
2009AAAAA000040700000000077
2009AAAAA000040700000000080
2009AAAAA000040814000000069
2009AAAAA000040814000000069
TRAILER..... ============> TRAILER COUNT IS 4
HEADER
2009BBBBB000040700000000077
2009BBBBB000040700000000080
2009BBBBB000040814000000069
2009BBBBB000040814000000069
TRAILER..... ============> TRAILER COUNT IS 4
HEADER
2009CCCCC000040700000000077
2009CCCCC000040700000000080
2009CCCCC000040814000000069
2009CCCCC000040814000000069
TRAILER..... ============> TRAILER COUNT IS 4
HEADER
2009DDDDD000040700000000077
2009DDDDD000040700000000080
2009DDDDD000040814000000069
2009DDDDD000040814000000069
TRAILER..... ============> TRAILER COUNT IS 4
HEADER
2009FI0KA E TDA73860
2009FI0KA E TDA75167
2009FI0KA G FC18
2009FI0KA K 2SA1576A
2009PP0FJ000040700000000077
2009PP0FJ000040700000000080
2009PP0FJ000040814000000069
2009PP0FJ000040814000000069
TRAILER.....
============> TRAILER COUNT IS 8
HEADER
2009EEEEE000040700000000077
2009EEEEE000040700000000080
2009EEEEE000040814000000069
2009EEEEE000040814000000069
TRAILER..... ============> TRAILER COUNT IS 4



output file:

HEADER
2009AAAAA000040700000000077
2009AAAAA000040700000000080
2009AAAAA000040814000000069
2009AAAAA000040814000000069
TRAILER..... ============> TRAILER COUNT IS 4
HEADER
2009BBBBB000040700000000077
2009BBBBB000040700000000080
2009BBBBB000040814000000069
2009BBBBB000040814000000069
TRAILER..... ============> TRAILER COUNT IS 4
HEADER
2009CCCCC000040700000000077
2009CCCCC000040700000000080
2009CCCCC000040814000000069
2009CCCCC000040814000000069
TRAILER..... ============> TRAILER COUNT IS 4
HEADER
2009DDDDD000040700000000077
2009DDDDD000040700000000080
2009DDDDD000040814000000069
2009DDDDD000040814000000069
TRAILER..... ============> TRAILER COUNT IS 4
HEADER
2009PP0FJ000040700000000077
2009PP0FJ000040700000000080
2009PP0FJ000040814000000069
2009PP0FJ000040814000000069
TRAILER.....
============> TRAILER COUNT IS 4
HEADER
2009EEEEE000040700000000077
2009EEEEE000040700000000080
2009EEEEE000040814000000069
2009EEEEE000040814000000069
TRAILER..... ============> TRAILER COUNT IS 4


Please let me know, if you need more clarification.

Thanks
Bodhi

Re: To update the trailer

PostPosted: Thu Mar 26, 2009 10:33 pm
by Frank Yaeger
The easiest way to do this might be to remove the original headers and trailers, remove the data records you don't want, and write a new HEADER record and TRAILER record with count for each "group". I can show you how to do that but I'm not sure you're telling me everything about the situation. So some questions:

Do you always just want to update the 5th "group" or might you want to update different groups or more than one group?

Does each HEADER record really just have 'HEADER' (which would make it easy to rebuild), or does it have other data that has to be kept?

Does each TRAILER record really just have 'TRAILER' and the 5-byte PD count for the group, or does it have other data that has to be kept?

Re: To update the trailer

PostPosted: Fri Mar 27, 2009 12:10 am
by bodhi
Hi Frank,

Below are the answer of your questions.

Do you always just want to update the 5th "group" or might you want to update different groups or more than one group?
Always I want to update the 5th group.

Does each HEADER record really just have 'HEADER' (which would make it easy to rebuild), or does it have other data that has to be kept?
My header is like: "HEADER CCCA_COST_DTL 2009-02-27-11.45.18.060259".


Does each TRAILER record really just have 'TRAILER' and the 5-byte PD count for the group, or does it have other data that has to be kept?
My trailer is: 'TRAILER' and the 5-byte PD count for the group. no other data.

Please let me know, if you need any more information.

Thanks
Bodhi.

Re: To update the trailer

PostPosted: Fri Mar 27, 2009 1:52 am
by Frank Yaeger
If I understand correctly what you want to do, then this DFSORT job should do it.

//S1    EXEC  PGM=SORT
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/220)
//SORTOUT DD DSN=...  output file (FB/220)
//SYSIN    DD    *
  OPTION COPY
  OMIT COND=(1,9,CH,EQ,C'2009FI0KA')
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,6,CH,EQ,C'HEADER'),
    PUSH=(221:ID=5,226:SEQ=9)),
   IFTHEN=(WHEN=INIT,OVERLAY=(226:226,9,ZD,SUB,+2,TO=PD,LENGTH=5))
  OUTFIL IFOUTLEN=220,
   IFTHEN=(WHEN=(221,5,ZD,EQ,5,AND,1,7,CH,EQ,C'TRAILER'),
     OVERLAY=(8:226,5))
/*

Re: To update the trailer

PostPosted: Fri Mar 27, 2009 11:58 am
by bodhi
Hi Frank,

Thnak you for helpinf me,

I am getting the syntax error. please let me know where we are wrong . Below is the log

SYSIN :
OPTION COPY
OMIT COND=(1,9,CH,EQ,C'2009FI0KA')
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,6,CH,EQ,C'HEADER'),
*
PUSH=(221:ID=5,226:SEQ=9))
IFTHEN=(WHEN=INIT,OVERLAY=(226:226,9,ZD,SUB,+2,TO=PD,LENGTH=5))
*
OUTFIL IFOUTLEN=220,
IFTHEN=(WHEN=(221,5,ZD,EQ,5,AND,1,7,CH,EQ,C'TRAILER'),
*
OVERLAY=(8:226,5))
WER268A INREC STATEMENT : SYNTAX ERROR
WER275A NO KEYWORDS FOUND ON CONTROL STATEMENT
WER270A OUTFIL STATEMENT : DUPLICATE PARM FOUND
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE

Re: To update the trailer

PostPosted: Fri Mar 27, 2009 8:53 pm
by Frank Yaeger
The job works fine with DFSORT. I assumed you were using DFSORT since you posted in the DFSORT Forum. But the WER messages indicate you're using Syncsort, not DFSORT. I'm a DFSORT developer. DFSORT and Syncsort are competitive products. I'm happy to answer questions on DFSORT and DFSORT's ICETOOL, but I don't answer questions on Syncsort.

Please post Syncsort questions in the Syncsort Forum.

Re: To update the trailer

PostPosted: Fri Apr 03, 2009 12:19 am
by Alissa Margulies
bodhi ,

Support for WHEN=GROUP was included in SyncSort for z/OS 1.3.2. Based on the limited information provided, I can only assume that you are running an earlier release of the product.

Re: To update the trailer

PostPosted: Tue Apr 07, 2009 9:59 am
by bodhi
Alissa,

Yes, i am using Z/OS 1.2.2.3R which create the problem. Thanks for the information.

Regards
Bodhi.