View previous topic :: View next topic
|
Author |
Message |
sankaranarayanan parasura
New User
Joined: 28 Oct 2007 Posts: 10 Location: chennai
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
sankaranarayanan parasura
New User
Joined: 28 Oct 2007 Posts: 10 Location: chennai
|
|
|
|
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 |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
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 |
|
|
sankaranarayanan parasura
New User
Joined: 28 Oct 2007 Posts: 10 Location: chennai
|
|
|
|
Hi Kolusu,
Thanks for that. I will try it out and close this post with screenshots.
Sankar |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Please continue using copy/paste and the Code tag rather than actual screenshots.
Thanks |
|
Back to top |
|
|
|