TRADER@cup.portal.com (07/06/88)
As always, a bug crept into my uploaded software... Paul McGinnis - TRADER@cup.portal.com Here is the corrected 5250 API program (written in Turbo C): ------------------------------------------------------- /* SAVESCRN.C - captures System/34/36/38 & AS/400 screen */ /* 7/5/1988 - programmer: Paul McGinnis, AST Research Data Comm */ /* Tech Support - Dept. 430 - 714-863-9991 */ #include <dos.h> #include <stdio.h> #include <5250dcb.h> static char *prog_info = "Programmer: Paul McGinnis - v1.02"; main(argc, argv) int argc; char *argv[]; { typedef unsigned char byte; typedef unsigned int word; char *fname; byte EBCDIC_char; word DCB_seg, j, xregen, xxlchr; FILE *screenfile, *fopen(); DCB_seg = peek(0, 0x36); if (DCB_seg == 0) { puts("Emulation not running or IBM-API not active."); return; } j = peek(DCB_seg, XEC) + 1; if (peek(DCB_seg, j) != 0x4345) /* Check emulation and version # */ { puts("Emulation not running or IBM-API not active."); return; } if (argc == 2) { screenfile = fopen(argv[1], "w"); if (!screenfile) { printf("Unable to write to file %s.\n", argv[1]); return; } } else { printf("File name of screen dump: "); gets(fname); screenfile = fopen(fname, "w"); if (!screenfile) { printf("Unable to write to file %s.\n", fname); return; } } xregen = peek(DCB_seg, XREGEN); xxlchr = peek(DCB_seg, XXLCHR); for (j = 0; j < 1920; j++) { EBCDIC_char = peekb(DCB_seg, xregen + j); if (j % 80 == 0) fprintf(screenfile, "\n"); fprintf(screenfile, "%c", peekb(DCB_seg, xxlchr + EBCDIC_char)); } fclose(screenfile); } /* Program tested with: */ /* Compiler: Borland Turbo C v1.5 */ /* Operating System: IBM PC-DOS v3.3 */ /* Computers: IBM PS/2 Model 30, AST Premium 286 */
TRADER@cup.portal.COM (07/06/88)
As always, a bug crept into my uploaded software... Paul McGinnis - TRADER@cup.portal.com Here is the corrected 5250 API program (written in Turbo C): ------------------------------------------------------- /* SAVESCRN.C - captures System/34/36/38 & AS/400 screen */ /* 7/5/1988 - programmer: Paul McGinnis, AST Research Data Comm */ /* Tech Support - Dept. 430 - 714-863-9991 */ #include <dos.h> #include <stdio.h> #include <5250dcb.h> static char *prog_info = "Programmer: Paul McGinnis - v1.02"; main(argc, argv) int argc; char *argv[]; { typedef unsigned char byte; typedef unsigned int word; char *fname; byte EBCDIC_char; word DCB_seg, j, xregen, xxlchr; FILE *screenfile, *fopen(); DCB_seg = peek(0, 0x36); if (DCB_seg == 0) { puts("Emulation not running or IBM-API not active."); return; } j = peek(DCB_seg, XEC) + 1; if (peek(DCB_seg, j) != 0x4345) /* Check emulation and version # */ { puts("Emulation not running or IBM-API not active."); return; } if (argc == 2) { screenfile = fopen(argv[1], "w"); if (!screenfile) { printf("Unable to write to file %s.\n", argv[1]); return; } } else { printf("File name of screen dump: "); gets(fname); screenfile = fopen(fname, "w"); if (!screenfile) { printf("Unable to write to file %s.\n", fname); return; } } xregen = peek(DCB_seg, XREGEN); xxlchr = peek(DCB_seg, XXLCHR); for (j = 0; j < 1920; j++) { EBCDIC_char = peekb(DCB_seg, xregen + j); if (j % 80 == 0) fprintf(screenfile, "\n"); fprintf(screenfile, "%c", peekb(DCB_seg, xxlchr + EBCDIC_char)); } fclose(screenfile); } /* Program tested with: */ /* Compiler: Borland Turbo C v1.5 */ /* Operating System: IBM PC-DOS v3.3 */ /* Computers: IBM PS/2 Model 30, AST Premium 286 */