Describe the sort files and merge files wnh SELECT statements in the Environment Division and SD (Sort File Description) entries in the Data Division. The sort file or merge file described in an SD entry is the working file used during the sort or merge operation.
You cannot execute any input/output statements for this file, and you do not create a DD statement in the run-time JCL for the file. Do not specify a block size for this file, because these factors are not under your control.
Code FD (File Description) entries, if needed, to describe files used as input to or output from a sort or merge operation. You can also sort or merge records that are defined only in Working Storage. If you are only sorting or merging data items from Working Storage and are not using files as input to or output from a sort or merge operation, you still need SD and FILE-CONTROL entries for the sort-file or merge-file. Every SD entry must contain a record description, for example:
Do not specify RECORDING MODE, BLOCK CONTAINS, or LABEL RECORDS in an SD entry.
The sort files and merge files are processed through a SORT or MERGE statement in the Procedure Division. The statement specifies the key field(s) within the record upon which the sort or merge is to be sequenced.
You can specify a key or keys as ascending or descending, or when you specify more than one key, as a mixture of the two.
You can mix SORT and MERGE statements in the same program. Within the limits of virtual storage, a VS COBOL II program can contain any number of sort or merge operations, each with its own independent input or output procedure.
The SORT Statement
You can specify input procedures to be performed on the sort records before they are sorted (SORT . . . INPUT PROCEDURE). You can specify output procedures to be performed on the sort records after they are sorted (SORT . . . OUTPUT PROCEDURE). You can use input or output procedures to add, delete, alter, edit, or otherwise modify the records. You can use the SORT statement to:
A COBOL program containing a sort operation is usually organized so that one or more input files are read and operated on by an input procedure. Within the input procedure, a RELEASE statement (analogous to the WRITE statement) places a record into the file to be sorted. That is, when input procedure execution is completed, all the records that are to be sorted have been given to DFSORT. If you do not want to modify or process the records before the sorting operation begins, the SORT statement USING option releases the unmodified records to the new file.
After all the input records have been passed to DFSORT, the sorting operation is executed. This operation arranges the entire set of records in the sequence specified by the key(s). After completion of the sorting operation, sorted records can be made available, one at a time, through a RETURN statement, for modification in an output procedure. If you don't want to modify or process the sorted records, the SORT statement GIVING option names the output file and writes the sorted records to an output file.
The MERGE Statement
You have access to output procedures (used after merging) that can modify the output records. Unlike the SORT statement, you cannot specify an input procedure in the MERGE statement; you must use MERGE . . . USING. The files to be merged must already be in the same sequence. The merge program then combines them into one sequenced file. A message may or may not be issued if the records within the files are out of sequence when Merge is called from a COBOL job.
The MERGE statement execution begins the merge processing. This operation compares keys within the records of the input files, and passes the sequenced records one-by-one to the RETURN statement of an output procedure or to the file named in the GIVING phrase.
If you want to process the merged records, they can be made available to your COBOL program, one at a time, through a RETURN statement in an output procedure. If you don't want to modify or process the merged records, the MERGE statement GIVING phrase names the merged output file into which the merged records will be written.
IBM Mainframe Related Interview Questions
|IBM Lotus Notes Interview Questions||IBM-CICS Interview Questions|
|COBOL Interview Questions||Linux Interview Questions|
|IBM-JCL Interview Questions||IBM Mainframe Interview Questions|
|IBM AIX Interview Questions||IBM WAS Administration Interview Questions|
|IBM Lotus Domino Interview Questions||IBM Integration Bus Interview Questions|
|Mainframe DB2 Interview Questions||Unix Production Support Interview Questions|
Ibm Mainframe Tutorial
Introduction To Software Development
Introduction To Ibm Mainframes
Tso And Ispf
Jes2, ]es3 And Sms
Introduction To Job Control Language (jcl)
The Job Statement
The Exec Statement
The Job And Exec Statements
The Dd Statement
Procedures And Symbolic Parameters
Generation Data Groups (gdg), Compile/link-edit And Run Jcls
Access Method Services (ams)
Additional Vsam Commands
Introduction To Rexx
Overview Of Rexx
Introduction To Cics
Exception Handling In Cics
Developing A Cics Application
Cics Programming Techniques
Basic Mapping Support (bms)
Transient Data Control
Temporary Storage Control
Interval And Task Control
Cics Application Design
Recovery And Restart
System Security And Intersystem Communication
Cics Debugging Facilities And Techniques
Bms Map Definition Macros And Copylib Members
Cics Response And Abend Codes
Data, Information And Information Processing
Introduction To Database Management Systems
Introduction To Relational Database Management Systems
Database Architecture And Data Modeling
Overview Of Db2
Structured Query Language (sql)
Data Security And Access
Db2 Application Development
Qmf And Db2i
Db2 Performance Monitoring, Utilities And Recovery/restart
Overview Of Information Management System (ims)
Introduction To Vs Cobol Ii
Overview Of Application Development In Vs Cobol Ii
Overview Of The Cobol Program
Sorting And Merging Files
Coding Cobol Programs That Run Under Cics. Ims, Db2 And Ispf
Compiling The Program
Link-editing The Program
Executing The Program
Improving Program Performance
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.