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

Is it possible to find hash total of an alphanumeric field


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

New User


Joined: 28 Oct 2007
Posts: 10
Location: chennai

PostPosted: Sat May 09, 2009 10:59 am
Reply with quote

Hi All,

I have a requirement to use DFSORT utility to verify the hash total calculated in COBOL program. I like to know is it possible to find hash total of an alphanumeric field using SORT and compare this with the one got created earlier.
If possible kindly suggest the control cards to use.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat May 09, 2009 11:37 am
Reply with quote

Hello and welcome to the forum,

Is this hash total for some field, a series of fields, an entire file. . .?

If you explain what needs to be "hash totaled" and post the cobol algorithm that calculates the hash total, we can see if a similar total might be calculated using sort.

Are you sure your system uses DFSORT?
Back to top
View user's profile Send private message
sankaranarayanan parasura

New User


Joined: 28 Oct 2007
Posts: 10
Location: chennai

PostPosted: Sun May 10, 2009 8:50 am
Reply with quote

Hi Dick,
Thanks for your support.
Apologies for the delayed response to your query.
As I am out of office I could not able to present you with the screen shots. However the model of COBOL syntax is like this.


Code:
01 EMPLOYEE-TABLE.
    05 EMPLOYEE-KEY.
        10 EMPLOYEE-NO    PIC 9(8).
        10 EMPLOYEE-F-NAME PIC X(12).
        10 EMPLOYEE L-NAME PIC X(12).
......
......
 
77 WS-EMPLOYEE-NAME  PIC 9(18) COMP.
77 WS-HASHTOTAL         PIC 9(18) COMP.
 
..
...
..
 
PROCEDURE DIVISION.
..
..
..
     READ EMPLOYEE-FILE UNTIL END-OF-FILE.
..
..
..
     MOVE EMPLOYEE-FNAME TO WS-EMPLOYEE-NAME.
     COMPUTE WS-HASHTOTAL = WS-HASHTOTAL + WS-EMPLOYEE-NAME.
...
...
...
WRITE-TRAILER-PARA
     .......
     .......
     MOVE WS-HASHTOTAL TO TRAILER-HASHTOTAL
     WRITE TRAILER RECORD.
 
EXIT-PARA.
STOP RUN.


In the above example it moves the alphabet to a COMP field and adds it together to find the total of that particular field and writes it in trailer record of the extract file created in this program.

Now I like to find the same thing using DFSORT so that it can be compared and cleared for further processing of file when it matches. This control step is the original requirement for this task.

Yes we have DFSORT installed in our system.
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Mon May 11, 2009 9:49 pm
Reply with quote

sankaranarayanan parasura,


You did not mention the lrecl and position of the field on which the total is being calculated. I assumed it as 80 byte file and FB format and the employee name starts in pos 1 for 12 bytes. The following DFSORT JCL will give you the desired results.

Code:

//STEP0100 EXEC PGM=SORT                         
//SYSOUT   DD SYSOUT=*                           
//SORTIN   DD DSN=Your input fb 80byte file,
//            DISP=SHR
//SORTOUT  DD SYSOUT=*                           
//SYSIN    DD *                                   
  SORT FIELDS=COPY                               
  INREC OVERLAY=(81:1,12,ZD,TO=BI,LENGTH=8)         
  OUTFIL REMOVECC,NODETAIL,BUILD=(1,80),         
  TRAILER1=('TOTAL HASH VALUE : ',               
            TOT=(81,8,BI,EDIT=(TTTTTTTTTTTTTTTT)))
/*
Back to top
View user's profile Send private message
sankaranarayanan parasura

New User


Joined: 28 Oct 2007
Posts: 10
Location: chennai

PostPosted: Tue May 12, 2009 8:33 am
Reply with quote

Hi Kolusu,

Thanks for that. I will try it out and close this post with screenshots.

Sankar
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue May 12, 2009 8:43 am
Reply with quote

Hello,

Please continue using copy/paste and the Code tag rather than actual screenshots.

Thanks icon_smile.gif
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 Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts To find whether record count are true... DFSORT/ICETOOL 6
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
No new posts Find the size of a PS file before rea... COBOL Programming 13
No new posts Join 2 files according to one key field. JCL & VSAM 3
Search our Forums:

Back to Top