To all who replied, thank you.
Yes, I tried the FOPEN, FWRITE, FCLOSE scenario.
In my Cobol mainline I FOPENed the file, gave me the file number which I
passed to the Pascal sub to do the FWRITE. The FWRITE failed with CC >
zeroes (CCG).
I tried to write an 80 byte char field to this file and the FWRITE failed.
Couldn't figure out why as the opened file is larger than 80 bytes.
FOPENed PASC001 OK
FCLOSE PASC001 OK
FOPENed PASC001 OK=>+0032<
1) THE REC-LENGTH =>-7060<
1) FILE NUMBER GOING IN=>+0032<
Processing:EXEC <
FWRITE BOO BOO, CC > ZEROES
I did a LISTFTEMP,2 after the program ran to see how many records were
written to the file and as you can see none were written at all:
listftemp,2
TEMPORARY FILES FOR MGR.E3K,PUB
ACCOUNT= E3K GROUP= PUB
FILENAME CODE ------------LOGICAL RECORD----------- ----SPACE----
SIZE TYP EOF LIMIT R/B SECTORS #X MX
PASC001 7060B FA 0 0 1 0 0 * (TEMP)
The Pascal code looks like this:
$sysintr 'sysintr.pub.sys'$
procedure FWRITE ; intrinsic;
$sysintr 'aifintr.pub.sys'$
procedure AIFJSGET ; intrinsic;
procedure AIFSYSWIDEGET; intrinsic;
PROCEDURE get_js_info(var overall_status :HPE_status;
var fwrite_parms :fwrite_parms_type;
var the_parms :the_parms_type;
var directory_name :dir_name_type;
var max_size_error :integer);
label 100, 999;
begin
the_parms.num_entries:= maximum_pids;
100:
aif_area := 1000;
item_num_array[1] := 1002;
item_num_array[2] := 0;
item_array [1] := addr(js_type);
js_type := the_parms.job_state;
max_size_error := 0;
overall_status.all:= 0;
the_parms.proc_no := 1;
search_key := 0;
item_status_array := init_item_status_array;
AIFSYSWIDEGET(overall_status,
aif_area,,
return_array_2,
the_parms.num_entries,
item_num_array,
item_array,
item_status_array);
if overall_status.all <> 0 then
goto 999;
if the_parms.num_entries = 0 then
begin
overall_status.info:= 500;
goto 999;
end;
if the_parms.num_entries = maximum_pids then
begin
the_parms.num_entries:= maximum_pids + incr_pids;
goto 100;
end;
if the_parms.num_entries > maximum_pids then
begin
overall_status.info:= 501;
max_size_error := the_parms.num_entries;
goto 999;
end;
stop_flag := 0;
counter_1 := 1;
overall_status.all:= 0;
repeat
job_session_no:=return_array_2[counter_1];
item_num_array[1] := 1037;
item_num_array[2] := 1001;
item_num_array[3] := 1009;
item_num_array[4] := 1011;
item_num_array[5] := 1010;
item_num_array[6] := 1005;
item_num_array[7] := 1014;
item_num_array[8] := 1015;
item_num_array[9] := 1012;
item_num_array[10]:= 1013;
item_num_array[11]:= 1020;
item_num_array[12]:= 1021;
item_num_array[13]:= 1034;
item_num_array[14]:= 0;
item_array [1] := addr(job_session_no);
item_array[2] := addr(the_parms.suag_buffer.job_name
[counter_1]);
item_array[3] := addr(the_parms.suag_buffer.user_name
[counter_1]);
item_array[4] := addr(the_parms.suag_buffer.acct_name
[counter_1]);
item_array[5] := addr(the_parms.suag_buffer.group_name
[counter_1]);
item_array[6] := addr(the_parms.quiet_mode
[counter_1]);
item_array[7] := addr(the_parms.logon_date_time.start_date
[counter_1]);
item_array[8] := addr(the_parms.logon_date_time.start_time
[counter_1]);
item_array[9] := addr(the_parms.io_devs.input_device
[counter_1]);
item_array[10] := addr(the_parms.io_devs.output_device
[counter_1]);
item_array[11] := addr(the_parms.spooled_restart.spooled
[counter_1]);
item_array[12] := addr(the_parms.spooled_restart.restart
[counter_1]);
item_array[13] := addr(the_parms.allow_mask
[counter_1]);
item_status_array := init_item_status_array;
the_parms.proc_no := 2;
AIFJSGET(overall_status,
item_num_array,
item_array,
item_status_array,
job_session_no);
if overall_status.all = 0 then
begin
the_parms.job_id.js_id [counter_1]:=job_session_no.js_type;
the_parms.job_id.job_number [counter_1]:=job_session_no.js_num;
directory_name [counter_1].user :=
the_parms.suag_buffer.user_name [counter_1];
directory_name [counter_1].group:=
the_parms.suag_buffer.group_name[counter_1];
directory_name [counter_1].acct:=
the_parms.suag_buffer.acct_name [counter_1];
fwrite_parms.rec_lgth:=80;
the_field:='hello there ';
FWRITE(fwrite_parms.file_num,
the_field,
fwrite_parms.rec_lgth,
fwrite_parms.ctl_code);
counter_1:= counter_1 + 1;
end
else
stop_flag:= 1;
until (counter_1 > the_parms.num_entries) or (stop_flag <> 0);
goto 999;
999:
end;
begin
end.
On Thu, 1 Jul 2004 16:36:42 -0800, Duane Percox <[log in to unmask]> wrote:
>Brian writes:
>>All:
>>
>>Scenario: Cobol mainline calling Pascal subroutine.
>>
>>Using Pascal, can anyone give me directions on how to
>>open a flat MPEiX file and write records to it and then close it?
>>
>>Any help/directions would be much appreciated.
>>
>>BTW -- needs to be done in a Pascal subroutine that retrieves
>>j/s data with "AIFJSGET". Many records can be retrieved and I
>>do not want to setup my Cobol mainline with OCCURS 'n' times
>>where 'n' could = 1000, 2000 etc etc.
>
>I would use intrinsics... hpfopen/fwrite/fclose/etc... instead
>of native pascal file i/o.
>
>You might want to check out www.allegro.com for any relevant papers
>on Pascal file I/O.
>
>duane
>
>* To join/leave the list, search archives, change list settings, *
>* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|