Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

About access methods RANDOM,DYNAMIC,SEQUENTIAL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
suresh_gop1
Warnings : 1

New User


Joined: 23 May 2006
Posts: 18

PostPosted: Wed Jul 25, 2007 9:49 am    Post subject: About access methods RANDOM,DYNAMIC,SEQUENTIAL
Reply with quote

Hi,

I want to know about access methods like RANDOM,DYNAMIC,SEQUENTIAL.
How these methods are chosen in the program? If I have to access 5000 records file. How can I choose? Record length is defined in JCL is 80 but cobol program length has 90. Record length is mismatched. so how can we handle this problem....

Thanks,
Suresh.G
Back to top
View user's profile Send private message

chintan

New User


Joined: 01 Jun 2007
Posts: 2
Location: banglore

PostPosted: Wed Jul 25, 2007 10:29 am    Post subject: About access methods
Reply with quote

for access method you have ot write in enivronment division
access mode


like


environment division.
input-output section.
file-contrl.
select empfile assign to dd1
organization is sequential
access mode random/dynamic/sequential.
Back to top
View user's profile Send private message
Tajuddin.sd

New User


Joined: 13 Jun 2007
Posts: 1
Location: Pune

PostPosted: Wed Jul 25, 2007 10:54 am    Post subject: Hi
Reply with quote

Hi to all,

Suppose i have three files namely file1,file2 and file3.

file1 contains
--------------
Account-number
Name

file2 contains
---------------
Account-number
Name

My question is.I have to match file1 Account-number with file2 Account-number and if they are equal i have to write the Account-number in third file i,e file3.Please let me know how to do
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Wed Jul 25, 2007 11:33 am    Post subject:
Reply with quote

Tajuddin.sd,

Please use 'NEW TOPIC' tab to post your question/s. This is not advisable to post a new query in reply of another topic. You may get warnings from Moderators.

By the way, would you like to solve your problem using JCL only(with utilites) or using COBOL? Both the approaches are available.
Back to top
View user's profile Send private message
sandeep1dimri

New User


Joined: 30 Oct 2006
Posts: 76

PostPosted: Wed Jul 25, 2007 11:38 am    Post subject:
Reply with quote

Hi Tajuddin

Open File on as

Open file on as sequential
Code:
SELECT file-1            ASSIGN file1


and file-2 as Indexed
(Please make ur second file as KEY sequence VSAM)

Code:
SELECT file2 ASSIGN TO File2       
 RECORD KEY IS RECORD-KEY-of-file2
 FILE STATUS IS F-STATUS-2                 
 ACCESS IS DYNAMIC                       
 ORGANIZATION IS INDEXED.

Procedure
Read the File-1 sequntially
Move Account number from File-1 to key of File-1
Code:
MOVE account-numbe in File-1 to RECORD-KEY-of-file2

Read file2
Code:
IF F-STATUS-2  not = Zeros

==> Implies account number present in file-1 is not present in file-2

Hope this Psudo code will help

Hope it also helped on Suresh query Too

Sandeep
Back to top
View user's profile Send private message
hello2satish

New User


Joined: 21 Jul 2007
Posts: 5
Location: Mumbai

PostPosted: Wed Jul 25, 2007 3:47 pm    Post subject: pls find the code
Reply with quote

Here i m reading invm and cust and writing invm moving only name from cust

*IDENTIFICATION DIVISION.
PROGRAM-ID. FILECOB.
AUTHOR. SATISH.
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT D01-INVM
ASSIGN TO "invm01"
ORGANIZATION IS LINE SEQUENTIAL
ACCESS IS SEQUENTIAL.
SELECT D02-CUST
ASSIGN TO "cust01"
ORGANIZATION IS LINE SEQUENTIAL
ACCESS IS SEQUENTIAL.
SELECT D03-OUTPUTFILE
ASSIGN TO "FILE"
ORGANIZATION IS LINE SEQUENTIAL
ACCESS IS SEQUENTIAL.
*
DATA DIVISION.
*
FILE SECTION.
*
FD D01-INVM.
01 D01-INVM-REC.
05 D01-BRN-CODE PIC 9(05).
05 D01-ACN-NO PIC 9(16).
05 D01-STATUS PIC 9(02).
05 D01-PRODUCT-CAT PIC 9(04).
05 D01-INT-CAT PIC 9(04).
05 D01-CUST-NO PIC 9(16).
05 D01-CURR-BAL PIC S9(14)V999
SIGN TRAILING SEPARATE.
FD D02-CUST.
01 D02-CUST-REC.
05 D02-BRN-CODE PIC 9(05).
05 D02-CUST-NO PIC 9(16).
05 D02-FULLNAME.
10 D02-FNAME PIC X(40).
10 D02-MNAME PIC X(40).
10 D02-LNAME PIC X(40).
FD D03-OUTPUTFILE.
01 D03-OUTPUT-REC.
05 D03-BRN-CODE PIC 9(05).
05 FILLER PIC X(01).
05 D03-ACN-NO PIC 9(16).
05 FILLER PIC X(01).
05 D03-CUST-NO PIC 9(16).
05 FILLER PIC X(01).
05 D03-STATUS PIC 9(02).
05 FILLER PIC X(01).
05 D03-PRODUCT-CAT PIC 9(04).
05 FILLER PIC X(01).
05 D03-INT-CAT PIC 9(04).
05 FILLER PIC X(01).
05 D03-FULLNAME.
10 D03-FNAME PIC X(40).
10 D03-MNAME PIC X(40).
10 D03-LNAME PIC X(40).
05 FILLER PIC X(01).
05 D03-CURR-BAL PIC S9(14)V999
SIGN TRAILING SEPARATE.
*
WORKING-STORAGE SECTION.
*
01 WS-EOF-FLAG-INVM PIC X(02).
01 WS-EOF-FLAG-CUST PIC X(02).
01 WS-RECORDS-WRITTEN PIC 9(05)
VALUE 0.
01 WS-AGE PIC 9(3).
01 WS-TOTAL-CURR-BAL PIC S9(14)V999
SIGN TRAILING SEPARATE VALUE 0.
PROCEDURE DIVISION.
*
0000-START.
*
OPEN INPUT D01-INVM.
OPEN INPUT D02-CUST.
OPEN OUTPUT D03-OUTPUTFILE.
MOVE SPACES TO D03-OUTPUT-REC.
PERFORM 1100-READ-INVM THRU 1100-EXIT.
PERFORM 1200-READ-CUST THRU 1200-EXIT.
0100-CONT.

*
PERFORM 1000-LOOP THRU 1000-EXIT
UNTIL WS-EOF-FLAG-INVM = "Y" OR WS-EOF-FLAG-CUST = "Y".
*
CLOSE D01-INVM.
CLOSE D02-CUST.
CLOSE D03-OUTPUTFILE.
*
DISPLAY "RECORDS WRITTEN TO OUTPUT FILE : "
WS-RECORDS-WRITTEN AT 1020.
DISPLAY " TOTAL CURRENT BALANCE IS : "
WS-TOTAL-CURR-BAL AT 2020.

*
STOP RUN.
*
1000-LOOP.
IF D01-CUST-NO = D02-CUST-NO
MOVE SPACES TO D03-OUTPUT-REC
MOVE D01-BRN-CODE TO D03-BRN-CODE
MOVE D01-ACN-NO TO D03-ACN-NO
MOVE D01-CUST-NO TO D03-CUST-NO
MOVE D01-STATUS TO D03-STATUS
MOVE D01-PRODUCT-CAT TO D03-PRODUCT-CAT
MOVE D01-INT-CAT TO D03-INT-CAT
MOVE D02-FULLNAME TO D03-FULLNAME
MOVE D01-CURR-BAL TO D03-CURR-BAL
WRITE D03-OUTPUT-REC
ADD D03-CURR-BAL TO WS-TOTAL-CURR-BAL
ADD 1 TO WS-RECORDS-WRITTEN
PERFORM 1100-READ-INVM THRU 1100-EXIT
PERFORM 1200-READ-CUST THRU 1200-EXIT
ELSE IF D01-CUST-NO > D02-CUST-NO
MOVE SPACES TO D03-OUTPUT-REC
MOVE D01-BRN-CODE TO D03-BRN-CODE
MOVE D01-ACN-NO TO D03-ACN-NO
MOVE D01-CUST-NO TO D03-CUST-NO
MOVE D01-STATUS TO D03-STATUS
MOVE D01-PRODUCT-CAT TO D03-PRODUCT-CAT
MOVE D01-INT-CAT TO D03-INT-CAT
MOVE SPACES TO D03-FULLNAME
MOVE D01-CURR-BAL TO D03-CURR-BAL
WRITE D03-OUTPUT-REC
ADD 1 TO WS-RECORDS-WRITTEN
ADD D03-CURR-BAL TO WS-TOTAL-CURR-BAL
PERFORM 1100-READ-INVM THRU 1100-EXIT
PERFORM 1200-READ-CUST THRU 1200-EXIT
ELSE
PERFORM 1100-READ-INVM THRU 1100-EXIT
END-IF.
1000-EXIT.
EXIT.
1100-READ-INVM.
READ D01-INVM
AT END
MOVE "Y" TO WS-EOF-FLAG-INVM
END-READ.
1100-EXIT.
EXIT.
1200-READ-CUST.
READ D02-CUST
AT END
MOVE "Y" TO WS-EOF-FLAG-CUST
END-READ.
1200-EXIT.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts find RACF group for access to spooled... jzhardy JCL & VSAM 1 Mon May 08, 2017 11:46 am
No new posts To find out size allocated to a seque... ashek15 JCL & VSAM 15 Thu Apr 27, 2017 9:42 am
No new posts Dynamic split of files under groups sril.krishy DFSORT/ICETOOL 4 Mon Apr 17, 2017 1:09 pm
No new posts Dynamic array request/response contai... Suja.Sai CICS 2 Tue Jan 24, 2017 11:37 am
No new posts REXX DB2: Dynamic allocation of DB2.D... BHAS CLIST & REXX 3 Mon Dec 19, 2016 8:26 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us