Viewing contents of file '../idllib/iuedac/iuelib/pro/ebcdic.pro'
;******************************************************************************
;+
;*NAME:
;
;	EBCDIC    (General IDL Library 01)   June 26, 1980
;
;*CLASS: 
;
;	format conversion, i/o
;
;*CATEGORY:
;
;*PURPOSE: 
;
;	Converts a 1-D byte array of EBCDIC code to a 1-D byte array of ASCII
;	code.
;
;*CALLING SEQUENCE:
;
;	EBCDIC,A
;
;*PARAMTERS:
;
;	A	(REQ) (I/O) (1) (B)
;		Required input and output vector containing the data to be
;		converted. At input, the code are assumed to be EBCDIC.  The
;		vector is returned with a vector byte array containing the
;		ASCII equivalents of the input vector.
;
;*EXAMPLES:
;
;	ebcdic,a
;
;*SYSTEM VARIABLES USED:
;
;	!iuer.dat
;
;*INTERACTIVE INPUT:
;
;	none
;
;*SUBROUTINES CALLED:
;
;	PCHECK
;	PARCHECK
;	IFITSRD
;
;*FILES USED: 
;
;	!iuer.dat EBCASC.FIT 
;
;*SIDE EFFECTS:
;
;	The original byte array is modified.
;
;*RESTRICTIONS: 
;
;*NOTES:
;
;*PROCEDURE
;
;	Each EBCDIC character is converted to its ASCII equivalent.
;
;*MODIFICATION HISTORY:
;
;    Jun 26 1980  K.G. Wilber  GSFC  initial program 
;    Apr 19 1985  JKF GSFC  modified to be compatible with XIDL /ERROR
;    Jun  7 1987  RWT GSFC  use vector assignment statement to remove
;           DO loop
;    Mar  9 1988  CAG GSFC  add VAX RDAF-style prolog, add
;           printout of calling sequence if executed without parameters,
;           and add check for parameters.
;    Sep  8 1989  RWT GSFC   Unix mods: change reference to ebcasc.dat
;           file, and use /get_lun 
;    4-10-91 KBC modify filename structure based on operating system type
;                for compatibility on SUN/DEC/VAX
;    6-21-91 PJL new directory structure environment variable with getenv;
;		 tested on SUN and VAX; updated prolog
;	16 Aug 93  PJL  access fits formated data file; added IFITSRD
;   2 Sep 94 LLT  replace IUER_DAT with !iuer.dat
;-
;******************************************************************************
 pro ebcdic,a
;
; print calling sequence if npar=0, and ck. parameters 
;
 npar = n_params(0)
 if (npar eq 0) then begin
    print,'EBCDIC,A'
    retall
 endif  ; npar eq 0
 parcheck,npar,1,'EBCDIC'
 pcheck,a,1,010,0100
;
; open conversion table and convert
;
 ifitsrd,!iuer.dat+'ebcasc.fit',1,nm,exhd,table,/silent
 a = table(a)
;
 return
 end  ; ebcdic