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
 

 

difference between read and read into

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

New User


Joined: 04 Jan 2008
Posts: 10
Location: hyderabad

PostPosted: Fri Jan 11, 2008 11:54 am    Post subject: difference between read and read into
Reply with quote

Hi,

is there any difference between READ and READ INTO commands?

READ file-name

READ file-name INTO field-name

is it like for variable length files , we need go with READ INTO command and not READ? is there any difference in the processing?

i got this doubt becoz of the following scenario.

i have a variable length file of 256 bytes and when i use the READ command to read the first record in the file, it reads multiple lines from the file equal to length of 252( 4 bytes for length).....at end when i look at the variable i can see data from multiple lines in the file. this is very strange for me. when i replaced READ with READ INTO, it is reading only the first line.

Please clarify.

Thanks.
Gomathi Priya
Back to top
View user's profile Send private message

guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Fri Jan 11, 2008 11:57 am    Post subject:
Reply with quote

Hi Gomanthi,

What do u mean by folowing?

Quote:
i have a variable length file of 256 bytes and when i use the READ command to read the first record in the file, it reads multiple lines from the file equal to length of 252( 4 bytes for length).....at end when i look at the variable i can see data from multiple lines in the file.


Please specify . How the variable accomdate data of multiple line.
Please provide ur code for clear undrstanding.
Back to top
View user's profile Send private message
gpriyaeng

New User


Joined: 04 Jan 2008
Posts: 10
Location: hyderabad

PostPosted: Fri Jan 11, 2008 12:12 pm    Post subject:
Reply with quote

Hi ,

input file was as follows..

0234567
BRasn M M #
MRS M M BRasn
United Kingdom
.345566
bfdbd
fhfdh
hjdjs


code was
FILE SECTION.

FD CUSTOMER-FILE
LABEL RECORDS ARE STANDARD
RECORD IS VARYING IN SIZE FROM 1 TO 252 CHARACTERS
BLOCK CONTAINS 0 RECORDS
RECORDING MODE IS V
DATA RECORD IS GMS0161I-REC.

01 INPUT-REC PIC X(252).



WORKING STORAGE..

01 WS-CUST-REC PIC X(252).

READ CUSTOMER-FILE
MOVE INPUT-REC TO WS-CUST-REC
DISPLAY WS-CUST-REC


The output in spool for the display statement was as follows...

0234567.....BRasn M M #.....MRS M M BRasn.....United Kingdom....

....

in the above we see that after the first read, the output field has multiple lines read from the file.

Thanks.
Gomathi Priya
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Fri Jan 11, 2008 12:14 pm    Post subject:
Reply with quote

Hi Gomathi,

Did u intialize ur WS-CUST-REC ?
Back to top
View user's profile Send private message
gpriyaeng

New User


Joined: 04 Jan 2008
Posts: 10
Location: hyderabad

PostPosted: Fri Jan 11, 2008 12:16 pm    Post subject:
Reply with quote

yes
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Fri Jan 11, 2008 12:20 pm    Post subject:
Reply with quote

Hi Gomathi,

Could u please provide the code of procedure division ?
Back to top
View user's profile Send private message
gpriyaeng

New User


Joined: 04 Jan 2008
Posts: 10
Location: hyderabad

PostPosted: Fri Jan 11, 2008 12:46 pm    Post subject:
Reply with quote

code is procedure division is as follows.

INITIALIZE WS-CUST-REC
READ CUSTOMER-FILE
MOVE INPUT-REC TO WS-CUST-REC
DISPLAY WS-CUST-REC
.....
Back to top
View user's profile Send private message
ousep143

New User


Joined: 06 Oct 2007
Posts: 32
Location: India

PostPosted: Fri Jan 11, 2008 2:45 pm    Post subject:
Reply with quote

Hi,
Try this one.Reply me.

FD CUSTOMER-FILE
LABEL RECORDS ARE STANDARD
RECORD IS VARYING IN SIZE FROM 1 TO 252 CHARACTERS
BLOCK CONTAINS 0 RECORDS
RECORDING MODE IS V
DATA RECORD IS GMS0161I-REC.

01 INPUT-REC.
05 WS-REC-LEN PIC S9(4) COMP.
05 WS-REC-TXT PIC X OCCURS 1 TO 252 TIMES
DEPENDING ON WS-REC-LEN.


Regards
icon_smile.gif
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 READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Read of TDQ fails in LENGERR Tracy Hansen CICS 10 Wed Apr 05, 2017 12:10 am
No new posts Difference between TWALENG and TWASIZE Arunkumar Chandrasekaran CICS 3 Tue Jan 03, 2017 12:57 pm
No new posts Sticky: difference between ... DUMMY ... and ... enrico-sorichetti JCL & VSAM 0 Mon Oct 17, 2016 4:31 pm
No new posts CICS VSAM RLS READ akodakka CICS 3 Tue Oct 04, 2016 3:09 pm


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