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 

internal sort program and jcl needed

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


Joined: 01 Mar 2005
Posts: 105
Topics: 58

PostPosted: Tue Nov 28, 2006 12:07 am    Post subject: internal sort program and jcl needed Reply with quote

Members,

Can anybody help me sample cobol program using internal simple SORT and the RUN JCL for it and i do not want to make use of INPUT and OUTPUT PROCEDUREs?

I want to make use of Simple SORT statement like:

Code:

SORT SORT-FILE                 
     ASCENDING KEY SORT-KEY   
     USING         INPUT-FILE 
     GIVING        OUTPUT-FILE.
Back to top
View user's profile Send private message
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Tue Nov 28, 2006 1:28 am    Post subject: Reply with quote

mfuser,

Try this code:
Code:

       FILE-CONTROL.
            SELECT INP-FILE  ASSIGN TO A.
            SELECT OUT-FILE  ASSIGN TO B.
            SELECT SORT-FILE   ASSIGN TO DUMMYAB.
       DATA DIVISION.
       FILE SECTION.
       SD SORT-FILE
          DATA RECORD IS SORT-RECORD.
       01 SORT-RECORD.
          05 SORT-KEY     PIC X(15).
          05 EMPINITIALS  PIC X(02).
          05 EMPNO        PIC 9(04).
          05 FILLER       PIC X(59).

       FD INP-FILE
           RECORDING MODE IS F
           BLOCK CONTAINS 0 CHARACTERS
           DATA RECORD IS INPUT-RECORD.

       01 INPUT-RECORD.
          05 EMPNAME      PIC X(15).
          05 EMPINITIALS  PIC X(02).
          05 EMPNO        PIC 9(04).
          05 FILLER       PIC X(59).

       FD OUT-FILE
           RECORDING MODE IS F
           BLOCK CONTAINS 0 CHARACTERS
           DATA RECORD IS OUTPUT-RECORD.

       01 OUTPUT-RECORD.
          05 EMPNAME      PIC X(15).
          05 EMPINITIALS  PIC X(02).
          05 EMPNO        PIC 9(04).
          05 FILLER       PIC X(59).

       WORKING-STORAGE SECTION.
       PROCEDURE DIVISION.
       0000-MAIN.

           SORT SORT-FILE
                ASCENDING KEY SORT-KEY
                USING         INP-FILE
                GIVING        OUT-FILE.

           IF SORT-RETURN = 0
              DISPLAY "SORT SUCCESS"
           ELSE
              DISPLAY "SORT FAILED"
           END-IF.

       0000-MAIN-EXIT.
           EXIT.
           GOBACK.

//STEP010 EXEC PGM=PGMNAME
//STEPLIB DD DSN=LOAD MODULE PDS NAME,DISP=SHR
//A DD DSN=INPUT DATASET NAME,DISP=SHR
//B DD DSN=OUTPUT DATASET NAME,DISP=SHR
//DUMMAB DD DUMMY
//

_________________
Shekar
Grow Technically
Back to top
View user's profile Send private message
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