Comparing files using syncsort and Cobol

Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Re: COmparing files using syncsort and Cobol

Postby tony1131 » Fri Mar 22, 2013 11:43 pm

I am sorting a file using syncsort, then using that output file within my cobol program to do a compare, The file that I am sending out can't contain the dash. And I don't know if this is done in the syncsort or where I am writing my cobol program. So i couldn't answer the guy. I registered this account saying I'm a beginner, and also mentioned it in the thread many times. I didn't even know what JCL was a month ago. So it might seem to you someone that has experience in the field that I am not using my brain, but I am explaining my situation the best I can. Have some patience
Last edited by tony1131 on Fri Mar 22, 2013 11:47 pm, edited 1 time in total.
Posts: 12
Joined: Thu Mar 21, 2013 9:45 pm
Has thanked: 0 time
Been thanked: 0 time

Re: COmparing files using syncsort and Cobol

Postby dick scherrer » Fri Mar 22, 2013 11:46 pm


but don't know if it's syncsort or cobol that would get rid of the dash in my output
That would be up to you . . .

I suspect you will be ahead if you pursue the COBOL solution. If someone provided a sorting solution, it is most likely that you would not understand it at this time. Being new, you most likely have done only "simple" sorting.

If you use a COBOL solution, the COBOL code would remove the dash (before the compare).
Hope this helps,
User avatar
dick scherrer
Global moderator
Posts: 6269
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: COmparing files using syncsort and Cobol

Postby BillyBoyo » Sat Mar 23, 2013 1:30 am

Since the task is for Cobol practice, do everything in Cobol except for a simple "sort" of each of your input files before the matching.

Here is one way to "get rid" of your "-" in Cobol.

01  a-field.
    05  af-first-part pic xx.
    05  af-dash pic x.
    05  af-last-part pic x(4).

01 another-field.
    05  anf-first-part pic xx.
    05  anf-last-part pic x(4).

    MOVE af-first-part TO anf-first-part
    MOVE af-last-part TO anf-last-part

There is no problem in sorting with the "-" in the field, as it is always present and always in the same place, so it will not affect the sort order into your program even if it not with the "-" on both files.
Global moderator
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 265 times

Re: COmparing files using syncsort and Cobol

Postby NicC » Sat Mar 23, 2013 4:49 pm

And NO, JCL cannot remove the dashes in your data as JCL does not look at any data. It does as was specified earlier.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Global moderator
Posts: 3026
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times


Return to IBM Cobol


  • Related topics
    Last post