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

Updating header with recounds count


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

New User


Joined: 30 Nov 2005
Posts: 19
Location: Bangalore

PostPosted: Thu Aug 02, 2007 5:26 pm
Reply with quote

Suppose, I have file with '10' records. The header is showing the count of all records in the file. This file has some duplicate records.... say for ex. 2 duplicate records.

I need to create a new file by remove the duplicate records and updating count in the header record. i.e. my new file should have 8 records (after removing the 2 duplicate records from the file of 10 records) and header record should show the count as 8.

Please note that record counts and duplicate records will vary from file to file.
Back to top
View user's profile Send private message
krisprems

Active Member


Joined: 27 Nov 2006
Posts: 649
Location: India

PostPosted: Thu Aug 02, 2007 5:37 pm
Reply with quote

Nanda Krishna
Give the sample set of i/p records, with the header format.
and also the o/p records.
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 Aug 02, 2007 8:58 pm
Reply with quote

Also, give the RECFM and LRECL of the input file and the starting position, length and format of the field you are using to check for duplicates.
Back to top
View user's profile Send private message
Nanda Krishna

New User


Joined: 30 Nov 2005
Posts: 19
Location: Bangalore

PostPosted: Fri Aug 03, 2007 9:29 am
Reply with quote

* RECFM = VB
* LRECL = 304
* starting position, length and format of the field you are using to check
for duplicates = (1, 13, CHAR) i.e. SORT FIELDS=(1,13,CH,A)
* In the header, record count is from pos 59-62 (length of 4 char)
* Input file and Output file are of same format and length.

Please let me know if you need any other information. Thanks in Advance icon_smile.gif
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 Aug 03, 2007 8:03 pm
Reply with quote

Quote:
Please let me know if you need any other information.


Please show an example of the records in the input file (just the relevant fields) and the records you expect in the output file.
Back to top
View user's profile Send private message
Nanda Krishna

New User


Joined: 30 Nov 2005
Posts: 19
Location: Bangalore

PostPosted: Sat Aug 04, 2007 7:23 pm
Reply with quote

Sample input file:
--------------------

Code:

Header:
---------
AX00 20070804025000RAMTX00056790                    00000000051357
* Here 0005 is the records count excluding hdr record and it starts
from pos. 59

Detail records:
-----------------
DRAPBBXA0
DRAPBBXA1
DRAPBBXA2 --> Duplicate record
DRAPBBXA2 --> Duplicate record
DRAPBBXA3


Sample output file should be ....
--------------------------------

Code:

Header:
---------
AX00 20070804025000RAMTX00056790                    00000000041357

Detail records:
-----------------
DRAPBBXA0
DRAPBBXA1
DRAPBBXA2
DRAPBBXA3


* One duplicate record(DRAPBBXA2) from the i/p file removed and the
header count is updated from 5 to 4.
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: Sat Aug 04, 2007 9:22 pm
Reply with quote

Here's a DFSORT job that will do what you asked for. Since the input file is VB, we need to add 4 bytes (for the RDW) to your starting positions. I assumed that the header record can be identified by the 'A' in position 1.

Code:

//S1    EXEC  PGM=ICEMAN                                         
//SYSOUT    DD  SYSOUT=*                                         
//SORTIN DD DSN=...  input file (VB)                             
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)       
//SYM DD DSN=&&S1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)     
//SYSIN    DD    *                                               
  SORT FIELDS=(5,13,CH,A)                                       
  SUM FIELDS=NONE                                               
  OUTFIL FNAMES=T1                                               
  OUTFIL FNAMES=SYM,REMOVECC,NODETAIL,VTOF,                     
    BUILD=(80X),                                                 
    TRAILER1=('NEWCT,''',COUNT-1=(M11,LENGTH=4),C'''')           
/*
//S2    EXEC  PGM=ICEMAN                                         
//SYSOUT    DD  SYSOUT=*                                         
//SYMNAMES DD DSN=&&S1,DISP=(OLD,PASS)                           
//SORTIN DD DSN=&&T1,DISP=(OLD,PASS)                             
//SORTOUT DD DSN=... output file (VB)                             
//SYSIN    DD    *                                               
  OPTION COPY                                                   
  INREC IFTHEN=(WHEN=(5,1,CH,EQ,C'A'),                           
    OVERLAY=(63:NEWCT))                                         
/*
Back to top
View user's profile Send private message
Nanda Krishna

New User


Joined: 30 Nov 2005
Posts: 19
Location: Bangalore

PostPosted: Tue Aug 07, 2007 2:26 pm
Reply with quote

Hi Frank,

Thanks for the DFSORT job. It is working as per expectations. But, when i am checking for syntax errors, i am getting the following error msg...(but the job ended with rc 00). Could you explain why it is so? Thanks for your time.

Sev Msg No. Message Text
-----------------------------------------------------
E1 8 DSS10065E Parameter 'COUNT-1' is unidentified.
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: Tue Aug 07, 2007 8:21 pm
Reply with quote

Huh? Checking for syntax errors how? If you received a DFSORT syntax error, it would be an ICExxxA message and you would not get RC=0.

Quote:
E1 8 DSS10065E Parameter 'COUNT-1' is unidentified.


This message is NOT from DFSORT. What program are you running that produces this error message?
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

 


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