MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Sort in Cobol giving Empty file..

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
karunkallore
Beginner


Joined: 11 Dec 2004
Posts: 103
Topics: 39

PostPosted: Mon Mar 28, 2005 11:13 am    Post subject: Sort in Cobol giving Empty file.. Reply with quote

Dear Friends,

I have this Program PGMA which takes one two input files FDES and FUNL. These are DDNAMES and the file name used in program are
FDES-FILE and FUNL-FILE.

The program Sorts these files based on some Keys and writes back to the same files.

Now for FUNL i have no Issues. But with FDES i have this queer problem with sort.

The Number of records in FDES is 108889 and in FUNL is 119845.

Now after the program is executed the FUNL is sorted and is Updated.

But the FDES file is empty !!!!!

The statments doing the sort for FDES file are :-

Code:

SORT  SORT-FDES-FILE                       
  ASCENDING  KEY                           
    KEY1                           
    KEY2                           
    KEY3                         
    KEY4                         
    KEY5
    KEY6   
      COLLATING SEQUENCE IS ASCII-SEQ       
      USING  FDES-FILE             
        OUTPUT  PROCEDURE  3000-FDES-OUTPUT
                                THRU       
                           3999-DESC-EXIT.


3000-FDES-OUTPUT  SECTION.                       
                                                 
3100-OPEN-FDES-FILE.                             
    OPEN  OUTPUT  FDES-FILE.               
                                                 
3200-FDES-OUTPUT-RETURN.                         
    RETURN  SORT-FDES-FILE   
      AT END                                     
        CLOSE  FDES-FILE                   
        GO TO  3999-DESC-EXIT.                   
       
3300-WRITE-DESC-FILE.

ADD  1  TO  CNT-OP-FDES.         
IF    KEY6  =  05       
  MOVE   XXXXXX  TO   
         FDES-FILE       
  WRITE  FDES-FILE       
  GO TO  3200-FDES-OUTPUT-RETURN.
 
  GO TO  3200-FUNL-SORT.

And similar kind of code for FUNL but with diff keys.

Now when i ran an Xpediter run i see that after this block of statments
Code:

SORT  SORT-FDES-FILE                       
  ASCENDING  KEY                           
    KEY1                           
    KEY2                           
    KEY3                         
    KEY4                         
    KEY5
    KEY6   
      COLLATING SEQUENCE IS ASCII-SEQ       
      USING  FDES-FILE             
        OUTPUT  PROCEDURE  3000-FDES-OUTPUT
                                THRU       
                           3999-DESC-EXIT.


the SORT-FDES-FILE is having a Blank record and control goes to the part where sorting of FUNL file. But the Input FDES file is having data not a blank record. When i run with less number of records then it goes fine. but the FUNL file has more records than that of FDES and excatly same kind of code excutes the sort for FUNL ( though the data is different ). And for FUNL there is no issue.

I thought okay in this bulk data i may have some Blank record some where so i Splitted the file FDES into some parts and i ran and all runs went fine.

I increased the SORTWKXX from 01 to 99 and i have the maximum space allocation also as given below :-

SORTWK01 DD DSN=&&WORK03,DISP=(NEW,DELETE),UNIT=SYSWK,
SPACE=(CYL,(999,999),RLSE)
*
*
*
*
SORTWK99 DD DSN=&&WORK03,DISP=(NEW,DELETE),UNIT=SYSWK,
SPACE=(CYL,(999,999),RLSE)

No Effect.Still when i give the original FDES file as input with Full data the Output FDES is empty after update from the program.

I cannot assume it as a Limitation for Sort as FUNL has more records and also it had six keys to sort. Also the FDES sort runs fine when i give it is small pieces.

Please guide me.

Thanks,
Karun.
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Mar 28, 2005 11:43 am    Post subject: Reply with quote

karun,

You are only writting the FDES file if the KEY6 = 05 . Are you sure that you have Records where key6=05?

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
karunkallore
Beginner


Joined: 11 Dec 2004
Posts: 103
Topics: 39

PostPosted: Mon Mar 28, 2005 12:20 pm    Post subject: Sure..i do have.. Reply with quote

Hi Kolsu,

Yeah i do have 05 records. For more clarity i am giving the follwoing sections also below. Sorry for not having at the first :-

DATA DIVISION.
FILE SECTION.

SD SORT-FDES-FILE
DATA RECORDS ARE SORT-REC1
SORT-REC2
SORT-REC3
SORT-REC4
SORT-REC4
SORT-REC5.


Here

01 SORT-REC2
03 KEY1 PIC X(9).
03 KEY2 PIC 9(4) COMP.
03 KEY-VAL.
05 KEY3 PIC 9(4) COMP.
05 KEY4 PIC X(30).
05 KEY5 PIC 9(8) COMP.
03 KEY6 PIC 9(2).

As i have mentioned when i spilt the file into chunks and then run , then i do not have an issue. If i run the file in chunks for each chunk then in Xpediter i have noticed as i cross the SORT verb i have data in SORT-FDES-FILE. But when i run it as a whole i am getting a Blank record first in
SORT-FDES-FILE.

Thanks,
Karun.
Back to top
View user's profile Send private message Send e-mail
kok328
Beginner


Joined: 05 Nov 2003
Posts: 19
Topics: 0
Location: MI, USA

PostPosted: Tue Mar 29, 2005 12:16 pm    Post subject: Reply with quote

Seem like this would be a whole lot easier and quicker using a simple sort with an OMIT/INCLUDE parm instead of COBOL
Back to top
View user's profile Send private message Send e-mail AIM Address
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Mar 29, 2005 12:25 pm    Post subject: Reply with quote

Karunkallore,

Is the SORT-FDES-FILE a Variable Block(VB) file?

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
karunkallore
Beginner


Joined: 11 Dec 2004
Posts: 103
Topics: 39

PostPosted: Tue Mar 29, 2005 8:06 pm    Post subject: Yeah it is..VB Reply with quote

Hi Kolsu,

The SORT-FDES-FILE is a VB file. I am giving the DCB and other parameters for it.


SDESC DD DSN=&&SDESC,
UNIT=SYSWK,
DISP=(NEW,PASS,DELETE),
SPACE=(CYL,(300,50),RLSE),
DCB=(RECFM=VB,BLKSIZE=27998)

Is that the problem. Because i have another file getting sorted in similar fashion ( UNLOAD ) having more records than this DESC.

Also i am giving the Sysout for the SORT for the abending job.

Here the program name is SUBCTS1A and in this program One more Input file UNLOAD is sorted sucessfully apart fro DESC.


1 SYNCSORT FOR Z/OS 1.1BRI TPF2B U.S. PATENTS: 4210961, 5117495 (C) 2002 SYNCSORT INC. DATE=2005/087 TIME=11.05.08
ELECTRONIC DATA SYSTEMS z/OS 1.4.0
PRODUCT LICENSED FOR CPU SERIAL NUMBER 11054, MODEL 2000 LICENSE/PRODUCT EXPIRATION DATE: 02 DEC 2006
PARMLIST :
SORT FIELDS=(0005,0009,AC,A,0014,0002,BI,A,0016,0002,BI,A,0018,0030,AC,A,0048,00
04,BI,A,0052,0002,ZD,A)
RECORD TYPE=V,LENGTH=(007545,,,000084,)
WER164B 13,956K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER164B 156K BYTES RESERVE REQUESTED, 13,300K BYTES USED
WER146B 12K BYTES OF EMERGENCY SPACE ALLOCATED
WER410B 12,768K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,
WER410B 0 BYTES RESERVE REQUESTED, 12,768K BYTES USED
WER036B G=1686,B=13672,SEGLEN=4584,BIAS=50
WER162B 300 PREALLOCATED SORTWORK TRACKS, 15,000 DYNAMICALLY ALLOCATED,
WER162B 0 ACQUIRED IN SECONDARY EXTENTS, 0 RELEASED, TOTAL OF 1,653 TRACKS USED
WER124I ESTIMATED PREALLOCATED/USED SORTWORK SPACE USAGE FACTOR = 0.18
WER045C END SORT PHASE
WER055I INSERT 108906, DELETE 0
WER418I DATASPACE(S) AND/OR HIPERSPACE(S) USED
WER135I TASK CALL/E35 TERMINATED PREMATURELY
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
WER416B SORTWK18: EXCP'S=3,UNIT=3390,DEV=2958,CHP=(85A1C4D1D5D8E7,1),VOL=SWK163
WER416B SORTWK16: EXCP'S=3,UNIT=3390,DEV=296C,CHP=(85A1C4D1D5D8E7,1),VOL=SWK238
WER416B SORTWK17: EXCP'S=3,UNIT=3390,DEV=3584,CHP=(0D011D819BAAA7CD,1),VOL=SWK299
WER416B SORTWK15: EXCP'S=3,UNIT=3390,DEV=2972,CHP=(85A1C4D1D5D8E7,1),VOL=SWK241
WER416B SORTWK19: EXCP'S=3,UNIT=3390,DEV=2670,CHP=(2C31383C555B797F,1),VOL=SWK035
WER416B SORTWK14: EXCP'S=3,UNIT=3390,DEV=3606,CHP=(0D011D819BAAA7CD,2),VOL=SWK336
WER416B SORTWK20: EXCP'S=3,UNIT=3390,DEV=2341,CHP=85A1ACC4D1D5D8E7,VOL=SWK122
WER416B SORTWK13: EXCP'S=3,UNIT=3390,DEV=35B6,CHP=(0D011D819BAAA7CD,1),VOL=SWK317
WER416B SORTWK12: EXCP'S=3,UNIT=3390,DEV=2664,CHP=(2C31383C555B797F,1),VOL=SWK002
WER416B SORTWK10: EXCP'S=3,UNIT=3390,DEV=2665,CHP=(2C31383C555B797F,1),VOL=SWK211
WER416B SORTWK09: EXCP'S=3,UNIT=3390,DEV=35B0,CHP=(0D011D819BAAA7CD,1),VOL=SWK311
WER416B SORTWK05: EXCP'S=3,UNIT=3390,DEV=2441,CHP=85A1ACC4D1D5D8E7,VOL=SWK125
WER416B SORTWK11: EXCP'S=3,UNIT=3390,DEV=3278,CHP=(0F1C4F9AAFB7,1),VOL=SWK087
WER416B SORTWK08: EXCP'S=3,UNIT=3390,DEV=2143,CHP=2C31383C555B797F,VOL=SWK060
WER416B SORTWK06: EXCP'S=3,UNIT=3390,DEV=35CC,CHP=(0D011D819BAAA7CD,2),VOL=SWK323
WER416B SORTWK04: EXCP'S=3,UNIT=3390,DEV=2316,CHP=85A1ACC4D1D5D8E7,VOL=SWK117
WER416B SORTWK02: EXCP'S=4,UNIT=3390,DEV=319D,CHP=(0F1C4F9AAFB7,1),VOL=SWK191
WER416B SORTWK07: EXCP'S=3,UNIT=3390,DEV=2652,CHP=(2C31383C555B797F,1),VOL=SWK056
WER416B SORTWK03: EXCP'S=3,UNIT=3390,DEV=35C9,CHP=(0D011D819BAAA7CD,1),VOL=SWK320
WER416B SORTWK01: EXCP'S=4,UNIT=3390,DEV=233C,CHP=85A1ACC4D1D5D8E7,VOL=SWK141
WER416B SORTWK21: EXCP'S=8,UNIT=3390,DEV=35C8,CHP=0D011D819BAAA7CD,VOL=SWK319
WER416B SORTWK22: EXCP'S=11,UNIT=3390,DEV=3635,CHP=0D011D819BAAA7CD,VOL=SWK351
WER416B TOTAL OF 81 EXCP'S ISSUED FOR SORTWORKS
WER416B TOTAL OF 81 EXCP'S ISSUED FOR SORTING
WER246I FILESIZE 82,312,581 BYTES
WER054I RCD IN 0, OUT 0
WER169I RELEASE 1.1B BATCH 0385 TPF LEVEL 2B
WER052I END SYNCSORT - TSTA125C,STANDB,SUBCTS1A,DIAG=CA00,C8D4,E23A,286E,83D6,6CCB,2368,06E6
1 SYNCSORT FOR Z/OS 1.1BRI TPF2B U.S. PATENTS: 4210961, 5117495 (C) 2002 SYNCSORT INC. DATE=2005/087 TIME=11.05.22
ELECTRONIC DATA SYSTEMS z/OS 1.4.0
PRODUCT LICENSED FOR CPU SERIAL NUMBER 11054, MODEL 2000 LICENSE/PRODUCT EXPIRATION DATE: 02 DEC 2006
PARMLIST :
SORT FIELDS=(0008,0009,AC,A,0018,0002,BI,A,0020,0002,BI,A,0022,0030,AC,A,0052,00
04,BI,A,0017,0001,AC,A)
RECORD TYPE=V,LENGTH=(001462,,,000136,)
OPTION SORTIN=UNLOAD
WER164B 13,956K BYTES OF VIRTUAL STORAGE AVAILABLE, MAX REQUESTED,
WER164B 156K BYTES RESERVE REQUESTED, 13,300K BYTES USED
WER146B 12K BYTES OF EMERGENCY SPACE ALLOCATED
WER108I UNLOAD : RECFM=VB ; LRECL= 1462; BLKSIZE= 27998
WER410B 12,768K BYTES OF VIRTUAL STORAGE AVAILABLE ABOVE THE 16MEG LINE,
WER410B 0 BYTES RESERVE REQUESTED, 12,768K BYTES USED
WER036B G=9458,B=47464,BIAS=57
WER162B 300 PREALLOCATED SORTWORK TRACKS, 2,520 DYNAMICALLY ALLOCATED,
WER162B 0 ACQUIRED IN SECONDARY EXTENTS, 0 RELEASED, TOTAL OF 2,069 TRACKS USED
WER124I ESTIMATED PREALLOCATED/USED SORTWORK SPACE USAGE FACTOR = 0.14
WER045C END SORT PHASE
WER055I INSERT 0, DELETE 119862
WER418I DATASPACE(S) AND/OR HIPERSPACE(S) USED
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
WER416B UNLOAD: EXCP'S=17,UNIT=3390,DEV=3177,CHP=(0F1C4F9AAFB7,1),VOL=APL013
WER416B SORTWK18: EXCP'S=3,UNIT=3390,DEV=2958,CHP=(85A1C4D1D5D8E7,1),VOL=SWK163
WER416B SORTWK16: EXCP'S=3,UNIT=3390,DEV=296C,CHP=(85A1C4D1D5D8E7,1),VOL=SWK238
WER416B SORTWK11: EXCP'S=3,UNIT=3390,DEV=3278,CHP=(0F1C4F9AAFB7,1),VOL=SWK087
WER416B SORTWK17: EXCP'S=3,UNIT=3390,DEV=3584,CHP=(0D011D819BAAA7CD,1),VOL=SWK299
WER416B SORTWK15: EXCP'S=3,UNIT=3390,DEV=2972,CHP=(85A1C4D1D5D8E7,1),VOL=SWK241
WER416B SORTWK19: EXCP'S=3,UNIT=3390,DEV=2670,CHP=(2C31383C555B797F,1),VOL=SWK035
WER416B SORTWK14: EXCP'S=3,UNIT=3390,DEV=3606,CHP=(0D011D819BAAA7CD,2),VOL=SWK336
WER416B SORTWK02: EXCP'S=4,UNIT=3390,DEV=319D,CHP=(0F1C4F9AAFB7,1),VOL=SWK191
WER416B SORTWK20: EXCP'S=3,UNIT=3390,DEV=2341,CHP=85A1ACC4D1D5D8E7,VOL=SWK122
WER416B SORTWK13: EXCP'S=3,UNIT=3390,DEV=35B6,CHP=(0D011D819BAAA7CD,1),VOL=SWK317
WER416B SORTWK12: EXCP'S=3,UNIT=3390,DEV=2664,CHP=(2C31383C555B797F,1),VOL=SWK002
WER416B SORTWK10: EXCP'S=3,UNIT=3390,DEV=2665,CHP=(2C31383C555B797F,1),VOL=SWK211
WER416B SORTWK09: EXCP'S=3,UNIT=3390,DEV=35B0,CHP=(0D011D819BAAA7CD,1),VOL=SWK311
WER416B SORTWK05: EXCP'S=3,UNIT=3390,DEV=2441,CHP=85A1ACC4D1D5D8E7,VOL=SWK125
WER416B SORTWK08: EXCP'S=3,UNIT=3390,DEV=2143,CHP=2C31383C555B797F,VOL=SWK060
WER416B SORTWK06: EXCP'S=3,UNIT=3390,DEV=35CC,CHP=(0D011D819BAAA7CD,2),VOL=SWK323
WER416B SORTWK04: EXCP'S=3,UNIT=3390,DEV=2316,CHP=85A1ACC4D1D5D8E7,VOL=SWK117
WER416B SORTWK07: EXCP'S=3,UNIT=3390,DEV=2652,CHP=(2C31383C555B797F,1),VOL=SWK056
WER416B SORTWK03: EXCP'S=3,UNIT=3390,DEV=35C9,CHP=(0D011D819BAAA7CD,1),VOL=SWK320
WER416B SORTWK01: EXCP'S=4,UNIT=3390,DEV=233C,CHP=85A1ACC4D1D5D8E7,VOL=SWK141
WER416B SORTWK21: EXCP'S=22,UNIT=3390,DEV=35C8,CHP=0D011D819BAAA7CD,VOL=SWK319
WER416B SORTWK22: EXCP'S=14,UNIT=3390,DEV=3678,CHP=0D011D819BAAA7CD,VOL=SWK354
WER416B TOTAL OF 98 EXCP'S ISSUED FOR SORTWORKS
WER416B TOTAL OF 115 EXCP'S ISSUED FOR SORTING
WER246I FILESIZE 97,829,244 BYTES
WER054I RCD IN 119862, OUT 0
WER169I RELEASE 1.1B BATCH 0385 TPF LEVEL 2B
WER052I END SYNCSORT - TSTA125C,STANDB,SUBCTS1A,DIAG=8E00,585C,A219,A0EE,D7F6,68E3,A648,AEE4


Regards,
Karun.
Back to top
View user's profile Send private message Send e-mail
karunkallore
Beginner


Joined: 11 Dec 2004
Posts: 103
Topics: 39

PostPosted: Wed Mar 30, 2005 1:24 pm    Post subject: The error code in Sort..CALL/E35 Reply with quote

Hi,

If one sees in the previous Post, there is a statement "WER135I TASK CALL/E35 TERMINATED PREMATURELY".

Can any one tell me what has casused it ?


Thanks,
karun.
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Mar 30, 2005 2:55 pm    Post subject: Reply with quote

karunkallore,

You said your input file is a Variable block file? Did you account for additional 4 bytes when calculating the relative pos of KEY6 ?

Also here is an explanation of WER135I

Code:

WER135I TASK CALL/E35 TERMINATED PREMATURELY                               
                                                                           
EXPLANATION:  An  E35  exit  routine (COBOL  Output  Procedure)  passed  a
return code of 8, terminating the sort before the sort was able to pass   
all of the records. A SORTOUT data set was not present.                   
                                                                           
This  message  may  not  indicate  an  error  condition -  it  depends  on
what  the programmer  intended.  For  example,  this  message  will  be   
generated  if  a COBOL program using the SORT verb RELEASEs 100 records in
the Input Procedure without RETURNing all 100 records in the Output       
Procedure because the logic dropped to the bottom of the Output Procedure 
"prematurely". If  this  is  what  the  programmer  intended,  then  no   
data  has  been  lost. If, however,  the  programmer  intended  the       
Output  Procedure  to  write  all  the records read in the Input           
Procedure, then this message indicates a logic bug in the COBOL program.   



Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
karunkallore
Beginner


Joined: 11 Dec 2004
Posts: 103
Topics: 39

PostPosted: Wed Mar 30, 2005 4:07 pm    Post subject: VB is considered... Reply with quote

Hello,

The same program works fine when this file FDES is spilt into two three parts. Then also the same VB is used. Both the Input and Output files are VB. As i already mentioned i did an Xpediter test on it using the Iput file giving me this issue. Here the control comes to this part of the code (given below ), To be specific the first statement (SORT SORT-FDES-FILE ) and Stops for some time then proceeds to 3000-FDES-OUTPUT . Here i had kept a KEEP on SORT-FDES-FILE . It was blank in the beginning of the program and after reading the code 'SORT SORT-FDES-FILE' it is still blank. But when i split this file and run seperately there is no issue and after this statement 'SORT SORT-FDES-FILE ' in Xpediter SORT-FDES-FILE has data and all processing goes fine.

Code:

SORT SORT-FDES-FILE
ASCENDING KEY
KEY1
KEY2
KEY3
KEY4
KEY5
KEY6
COLLATING SEQUENCE IS ASCII-SEQ
USING FDES-FILE
OUTPUT PROCEDURE 3000-FDES-OUTPUT
THRU
3999-DESC-EXIT.


What amazes me is that the Other File that i had mentioned FUNL is having more records than this FDES, it is also both VB ( for Input and Output ) and it also has same 6 keys. It also has similar check before writing to the output file. Still no issues in that. But for this file FDES , it has data before the program is excuted but after it has the file is empty.

Please help me out to understand this. If any other inputs is required i am all there for all.

Thanks again in advance,
Karun.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group