View previous topic :: View next topic
|
Author |
Message |
skkp2006
New User
Joined: 14 Jul 2006 Posts: 93 Location: Chennai,India
|
|
|
|
Hi,
I am using SYNCSORT FOR Z/OS 1.3.2.1R. I need to re-create the Header and trailer(elimate the duplicates) for a set of detailed records
RECFM=FB and LRECL=80
Input Records
Code: |
H20100519000001122
Cdetail
Adetail
T000001122
H20100519000001122
Cdetail
Adetail
T000001122 |
Expected Output
Code: |
HYYYYMMDD000000004
Cdetail
Adetail
Cdetail
Adetail
T000000004 |
where XXXXXXXXXX is the count of the number of records.
I tried the following sort card...
Code: |
SORT FIELDS=(2,10,CH,A)
OMIT COND=(1,1,CH,EQ,C'H',OR,1,1,CH,EQ,C'T')
OUTFIL FILES=OUT,REMOVECC,
HEADER1=(1:C'H',2:DATENS=(4MD),12:COUNT=(M11,LENGTH=09),
TRAILER1=(1:C'T',COUNT=(M11,LENGTH=9)) |
However.....its abending showing error near the COUNT in the Header. Can we use the COUNT parameter in the HEADER field or is it limited to TRAILER alone?
Code: |
HEADER1=(1:C'H',2:DATENS=(4MD),12:COUNT=(M11,LENGTH=09),
* |
I am looking to achieve this in a single pass.Any pointers will be real helpful.
regards,
Syam |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Given the trailer already has the count why do you want it be duplicated. |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
without seeing the error message, my guess is that you cannot use COUNT with HEADER1.
After all, the HEADER is the first record written out, the count will not occur until all input records have been read.
Gerry |
|
Back to top |
|
|
skkp2006
New User
Joined: 14 Jul 2006 Posts: 93 Location: Chennai,India
|
|
|
|
Arun,
That is a part of the requirement to have the count in the Header as well. Currently the program which creates this file is opening the file in I-O mode and re-writing the Header to have the count.
Gerry,
Here is the sysout.
Code: |
SYSIN :
SORT FIELDS=(2,10,CH,A)
OMIT COND=(1,1,CH,EQ,C'H',OR,1,1,CH,EQ,C'T')
OUTFIL FILES=OUT,REMOVECC,
HEADER1=(1:C'H',2:DATENS=(4MD),COUNT=(M11,LENGTH=9)),
*
TRAILER1=(1:C'T',COUNT=(M11,LENGTH=9))
OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,
BUILD=(80X),
TRAILER1=('NEWCT,''',COUNT=(M11,LENGTH=9),C'''')
WER268A OUTFIL STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE |
Regards,
Syam |
|
Back to top |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Hello
I dont have access to mainframe. I guess it is not as direct as you have tried. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Suggest you consider using the existing process. . .
To get the count in the header you will probably need another full pass of the data which is most wasteful. . . |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
According to the manual, COUNT is valid on a TRAILER, but it does not show it being valid on a HEADER.
No matter how much you want it to be so, it is not. |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Quote: |
I am looking to achieve this in a single pass.Any pointers will be real helpful. |
Since the data is (probably) already in the sequence you need to count, do one pass as copy with the omits and generate the header and trailer as a two record trailer. Then re-sort to re-sequence the headers to their proper location.
Seems a more elegant solution than re-reading the file in i/o mode...... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
But still has to pass all of the data "again". . . I realize that lots of files are only a few records, but my "little" files are multi-million records. . . Extra passes/sorts of data are not my friend
[Rant]
Personally, i believe it is nonsense to require the total record count in the first record ("header" or otherwise) . . . But there are lots of nonsensical requirements.
[/Rant] |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Currently the OP is sortiing the entire file (pass one) and then (COBOL?) reading the entire file to get the trailer counts and rewriting the headers (pass two).
I would think that two sort passes would be a lot quicker than the one i/o pass..... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Possibly i read this wrong, but sounded like the data was created in one "pass" and the the first record was then re-read and updated directly with no additional reading of the rest of the records. |
|
Back to top |
|
|
skkp2006
New User
Joined: 14 Jul 2006 Posts: 93 Location: Chennai,India
|
|
|
|
Hi,
The existing process is
1.Table unload of the data.
2.Process the records in a cobol program which creates the header and trailer. The same program updates the header for the file in I-O mode in the end.
Both 1 and 2 are happening for a set of records using different selection process(Job1 thru 3) and getting concatenated as an input file to process in the subsquent job(Job4).
the input for this job will have multiple header and trailers with different counts in various files.
Before the job process this file i have to feed the updated count in the Header and Trailer.
Code: |
Job1 Job 2 Job 3
HYYYYMMDD000000003 HYYYYMMDD000000002 HYYYYMMDD000000001
detail detail detail
detail detail T000000001
detail T000000002
T000000003 |
Code: |
Job 4
HYYYYMMDD000000003
detail
detail
detail
T000000003
HYYYYMMDD000000002
detail
detail
T000000002
HYYYYMMDD000000001
detail
T000000001 |
Here before the Job4 starts the Header and Trailer should be updated with 6 as the count.
Syam |
|
Back to top |
|
|
|