2012-02-05 11:35:58 -05:00
|
|
|
/****************************************************************
|
|
|
|
* *
|
2012-10-29 18:54:31 -04:00
|
|
|
* Copyright 2001, 2012 Fidelity Information Services, Inc *
|
2012-02-05 11:35:58 -05:00
|
|
|
* *
|
|
|
|
* This source code contains the intellectual property *
|
|
|
|
* of its copyright holder(s), and is made available *
|
|
|
|
* under a license. If you do not know the terms of *
|
|
|
|
* the license, please stop and do not read further. *
|
|
|
|
* *
|
|
|
|
****************************************************************/
|
|
|
|
|
|
|
|
#include "mdef.h"
|
|
|
|
#include "gtm_iconv.h"
|
|
|
|
#include "io.h"
|
|
|
|
#include "iosp.h"
|
|
|
|
#include "iotimer.h"
|
|
|
|
#include "stringpool.h"
|
|
|
|
#include "op.h"
|
|
|
|
#include "ebc_xlat.h"
|
|
|
|
|
2012-10-29 18:54:31 -04:00
|
|
|
#include "gdsroot.h"
|
|
|
|
#include "gdskill.h"
|
|
|
|
#include "gdsbt.h"
|
|
|
|
#include "gtm_facility.h"
|
|
|
|
#include "fileinfo.h"
|
|
|
|
#include "gdsfhead.h"
|
|
|
|
#include "gdscc.h"
|
|
|
|
#include "filestruct.h"
|
|
|
|
#include "buddy_list.h" /* needed for tp.h */
|
|
|
|
#include "jnl.h"
|
|
|
|
#include "hashtab_int4.h" /* needed for tp.h */
|
|
|
|
#include "tp.h"
|
|
|
|
#include "send_msg.h"
|
|
|
|
#include "gtmmsg.h" /* for gtm_putmsg() prototype */
|
|
|
|
#include "change_reg.h"
|
|
|
|
#include "setterm.h"
|
|
|
|
#include "getzposition.h"
|
|
|
|
#ifdef DEBUG
|
|
|
|
#include "have_crit.h" /* for the TPNOTACID_CHECK macro */
|
|
|
|
#endif
|
|
|
|
|
|
|
|
GBLREF uint4 dollar_trestart;
|
2012-02-05 11:35:58 -05:00
|
|
|
GBLREF io_pair io_curr_device;
|
|
|
|
GBLREF io_desc *active_device;
|
|
|
|
GBLREF spdesc stringpool;
|
|
|
|
|
2012-10-29 18:54:31 -04:00
|
|
|
error_def(ERR_TEXT);
|
|
|
|
|
|
|
|
#define READTIMESTR "READ time too long"
|
|
|
|
|
2012-02-05 11:35:58 -05:00
|
|
|
int op_read(mval *v, int4 timeout)
|
|
|
|
{
|
|
|
|
int stat;
|
|
|
|
mval val;
|
|
|
|
size_t cnt, insize, outsize;
|
|
|
|
unsigned char *temp_ch;
|
|
|
|
char *start_ptr, *save_ptr;
|
2012-10-29 18:54:31 -04:00
|
|
|
DCL_THREADGBL_ACCESS;
|
2012-02-05 11:35:58 -05:00
|
|
|
|
2012-10-29 18:54:31 -04:00
|
|
|
SETUP_THREADGBL_ACCESS;
|
2012-02-05 11:35:58 -05:00
|
|
|
if (timeout < 0)
|
|
|
|
timeout = 0;
|
2012-10-29 18:54:31 -04:00
|
|
|
else if (TREF(tpnotacidtime) < timeout)
|
|
|
|
TPNOTACID_CHECK(READTIMESTR);
|
2012-02-05 11:35:58 -05:00
|
|
|
active_device = io_curr_device.in;
|
|
|
|
v->mvtype = MV_STR;
|
|
|
|
v->str.len = 0;
|
|
|
|
stat = (io_curr_device.in->disp_ptr->read)(v, timeout);
|
2012-10-29 18:54:31 -04:00
|
|
|
if (stringpool.free == (unsigned char *)v->str.addr) /* BYPASSOK */
|
2012-02-05 11:35:58 -05:00
|
|
|
stringpool.free += v->str.len; /* see UNIX iott_readfl */
|
|
|
|
assert(stringpool.free <= stringpool.top);
|
2012-10-29 18:54:31 -04:00
|
|
|
# ifdef KEEP_zOS_EBCDIC
|
2012-02-05 11:35:58 -05:00
|
|
|
if (DEFAULT_CODE_SET != io_curr_device.in->in_code_set)
|
|
|
|
{
|
|
|
|
cnt = insize = outsize = v->str.len;
|
|
|
|
assert(stringpool.free >= stringpool.base);
|
|
|
|
ENSURE_STP_FREE_SPACE(cnt);
|
|
|
|
temp_ch = stringpool.free;
|
|
|
|
save_ptr = v->str.addr;
|
|
|
|
start_ptr = (char *)temp_ch;
|
|
|
|
stringpool.free += cnt;
|
|
|
|
assert(stringpool.free >= stringpool.base);
|
|
|
|
assert(stringpool.free <= stringpool.top);
|
|
|
|
ICONVERT(io_curr_device.in->input_conv_cd, (unsigned char **)&v->str.addr, &insize, &temp_ch, &outsize);
|
|
|
|
v->str.addr = start_ptr;
|
|
|
|
}
|
2012-10-29 18:54:31 -04:00
|
|
|
# endif
|
2012-02-05 11:35:58 -05:00
|
|
|
active_device = 0;
|
|
|
|
if (NO_M_TIMEOUT != timeout)
|
|
|
|
return(stat);
|
|
|
|
return FALSE;
|
|
|
|
}
|