🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.protocols.ibm
Article #1291

5250 API programs

#1291
From: TRADER
Date: Sun, 03 Jul 1988 21:50
79 lines
2958 bytes
Does anyone else out there have an interest in the IBM 5250 API?
This is the Applications Program Interface used in the emulation boards
that hook PC's to System/34/36/38's and AS/400's. It is used in
IBM's enhanced emulation products as well as the emulators that are
fully IBM-API compatible such as those made by AST Research.

If you'd like to swap info and/or programs, please let me know -
I can't give company confidential things out, but I have a lot of
info.

                                  Paul McGinnis
                                  TRADER@cup.portal.com

Here is a sample API program that I wrote in Turbo C that captures a
terminal screen to a disk file.

---------------------------------------------------------------------

/*  SAVESCRN.C - captures System/34/36/38 & AS/400 screen             */
/*  7/1/1988 - programmer: Paul McGinnis, AST Research Data Comm      */
/*                          Tech Support - Dept. 430 - 714-863-9991   */

#include <dos.h>
#include <stdio.h>
#define XREGEN 0x146    /* EBCDIC screen buffer pointer offset */
#define XXLCHR 0x140    /* EBCDIC-to-ASCII table pointer offset */

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");
  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                   */
Technical Details
Message-ID: <8807042128.AA08776@jade.berkeley.edu>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!husc6!mailrus!uwmcsd1!ig!agate!ucbvax!cup.portal.COM!TRADER

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!husc6!mailrus!uwmcsd1!ig!agate!ucbvax!cup.portal.COM!TRADER
From: TRADER@cup.portal.COM
Newsgroups: comp.protocols.ibm
Subject: 5250 API programs
Message-ID: <8807042128.AA08776@jade.berkeley.edu>
Date: 3 Jul 88 21:50:23 GMT
Sender: daemon@ucbvax.BERKELEY.EDU
Reply-To: portal!cup.portal.com!TRADER@uunet.uu.net
Organization: The Internet
Lines: 79