From:	CRDGW2::CRDGW2::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 27-FEB-1991 05:07:01.17
To:	ARISIA::EVERHART
CC:	
Subj:	re (2) : PSI logfiles (in vms_share format)

From:	RELAY-INFO-VAX@CRVAX.SRI.COM@SMTP@CRDGW2
To:	Everhart@Arisia@MRGATE

Received:  by crdgw1.ge.com (5.57/GE 1.87)
	 id AA28346; Wed, 27 Feb 91 04:47:19 EST
Message-Id:  <9102270947.AA28346@crdgw1.ge.com>
Received: From CUNYVM.CUNY.EDU by CRVAX.SRI.COM with TCP; Tue, 26 FEB 91 09:06:44 PST
Received: from FRONI51.BITNET by CUNYVM.CUNY.EDU (IBM VM SMTP R1.2.2MX) with BSMTP id 6895; Tue, 26 Feb 91 12:07:04 EST
Date: 26 FEB 91 18:06:08.02-GMT
From: ONETO%FRONI51.BITNET@CUNYVM.CUNY.EDU
Subject: re (2) : PSI logfiles (in vms_share format)
To: INFO-VAX@KL.SRI.COM

Date sent:  26-FEB-1991 16:53:52 GMT

        Hi again Net !
        I realize when I received my own mail through info-vax (Bitnet)
that the program was rather in bad shape, due to the ASCII-EBCDIC-ASCII
conversions. So I prefer to repost it in vmsshare format. Please discard
the previous message. I also included another program which add <LF> at
the end of each line of a file, so you can transmit it with a :
PAD> set input/speed=... filename
        command. Here we use it to send Telex through PSI, but that's
just an example.
>Date sent:  25-FEB-1991 13:49:21 GMT
>
>        Hi Net !
>        Don Stokes <GPWRDCS@gp.co.nz>, in answer to
><1lendl@edvz.uni-salzburg.ada.at>, wrote :
>>>I've got problems with the PSI logfiles.
>>>When I connect to mailboxes or other hosts via X.25 I issue the
>>>set host command with the /log qualifier to get a log of the session.
>>>( i.e. $ SET HOST/X29/LOG=mbox.log xxxxx  )
>>>
>>>When I use "TYPE" to cat the logfile to the terminal everything seems okay,
>>>but if I want to edit it, I notice that the file is NOT okay. There are some
>>>fuzzy characters in it, the line-termination isn't okay, ...
>>>
>[...]

        Here begin my former message:
>        I ran against this very same problem, and after playing around
>with FDL, CONVERT and other niceties, I finally wrote the following
>little program to filter the garbage characters out... I'm glad to share
>it with the net... Of course, standard disclaimer applies, but I will
>accept any improvement !
>(for example, I've plan to take parameters froms the command line, with
>default extensions, to convert it to VAX-C... but there is only 24 hour
>a day, and may be sometimes less !)
-------------------- start of psi.share_1_of_1 --------------------
$! ------------------ CUT HERE -----------------------
$ v='f$verify(f$trnlnm("SHARE_VERIFY"))'
$!
$! This archive created by VMS_SHARE Version 7.2-007  22-FEB-1990
$!   On 26-FEB-1991 16:49:58.78   By user ONETO
$!
$! This VMS_SHARE Written by:
$!    Andy Harper, Kings College London UK
$!
$! Acknowledgements to:
$!    James Gray       - Original VMS_SHARE
$!    Michael Bednarek - Original Concept and implementation
$!
$! TO UNPACK THIS SHARE FILE, CONCATENATE ALL PARTS IN ORDER
$! AND EXECUTE AS A COMMAND PROCEDURE  (  @name  )
$!
$! THE FOLLOWING FILE(S) WILL BE CREATED AFTER UNPACKING:
$!       1. READPSI.PAS;1
$!       2. INSLF.FOR;1
$!
$set="set"
$set symbol/scope=(nolocal,noglobal)
$f=f$parse("SHARE_TEMP","SYS$SCRATCH:.TMP_"+f$getjpi("","PID"))
$e="write sys$error  ""%UNPACK"", "
$w="write sys$output ""%UNPACK"", "
$ if f$trnlnm("SHARE_LOG") then $ w = "!"
$ ve=f$getsyi("version")
$ if ve-f$extract(0,1,ve) .ges. "4.4" then $ goto START
$ e "-E-OLDVER, Must run at least VMS 4.4"
$ v=f$verify(v)
$ exit 44
$UNPACK: SUBROUTINE ! P1=filename, P2=checksum
$ if f$search(P1) .eqs. "" then $ goto file_absent
$ e "-W-EXISTS, File ''P1' exists. Skipped."
$ delete 'f'*
$ exit
$file_absent:
$ if f$parse(P1) .nes. "" then $ goto dirok
$ dn=f$parse(P1,,,"DIRECTORY")
$ w "-I-CREDIR, Creating directory ''dn'."
$ create/dir 'dn'
$ if $status then $ goto dirok
$ e "-E-CREDIRFAIL, Unable to create ''dn'. File skipped."
$ delete 'f'*
$ exit
$dirok:
$ w "-I-PROCESS, Processing file ''P1'."
$ if .not. f$verify() then $ define/user sys$output nl:
$ EDIT/TPU/NOSEC/NODIS/COM=SYS$INPUT 'f'/OUT='P1'
PROCEDURE Unpacker ON_ERROR ENDON_ERROR;SET(FACILITY_NAME,"UNPACK");SET(
SUCCESS,OFF);SET(INFORMATIONAL,OFF);f:=GET_INFO(COMMAND_LINE,"file_name");b:=
CREATE_BUFFER(f,f);p:=SPAN(" ")@r&LINE_END;POSITION(BEGINNING_OF(b));
LOOP EXITIF SEARCH(p,FORWARD)=0;POSITION(r);ERASE(r);ENDLOOP;POSITION(
BEGINNING_OF(b));g:=0;LOOP EXITIF MARK(NONE)=END_OF(b);x:=ERASE_CHARACTER(1);
IF g=0 THEN IF x="X" THEN MOVE_VERTICAL(1);ENDIF;IF x="V" THEN APPEND_LINE;
MOVE_HORIZONTAL(-CURRENT_OFFSET);MOVE_VERTICAL(1);ENDIF;IF x="+" THEN g:=1;
ERASE_LINE;ENDIF;ELSE IF x="-" THEN IF INDEX(CURRENT_LINE,"+-+-+-+-+-+-+-+")=
1 THEN g:=0;ENDIF;ENDIF;ERASE_LINE;ENDIF;ENDLOOP;t:="0123456789ABCDEF";
POSITION(BEGINNING_OF(b));LOOP r:=SEARCH("`",FORWARD);EXITIF r=0;POSITION(r);
ERASE(r);x1:=INDEX(t,ERASE_CHARACTER(1))-1;x2:=INDEX(t,ERASE_CHARACTER(1))-1;
COPY_TEXT(ASCII(16*x1+x2));ENDLOOP;WRITE_FILE(b,GET_INFO(COMMAND_LINE,
"output_file"));ENDPROCEDURE;Unpacker;QUIT;
$ delete/nolog 'f'*
$ CHECKSUM 'P1'
$ IF CHECKSUM$CHECKSUM .eqs. P2 THEN $ EXIT
$ e "-E-CHKSMFAIL, Checksum of ''P1' failed."
$ ENDSUBROUTINE
$START:
$ create 'f'
Xprogram readpsi (input, output);
X
Xconst
X  titre    = 'Filtrage de Fichiers recus par Transpac, sous VAX/VMS';
X  version  = 'Version 0.02 du 14-JAN-1989';
X  auteur   = 'Jean-Louis Oneto';
X
Xtype
X  name     = varying `5B80`5D of char;
X  fichier  = text;
X
Xvar
X  source                  : fichier;
X  dest                    : fichier;
X  source_name, dest_name  : name;
X  i                       : integer;
X  ii                      : integer;
X  car_in                  : char;
X  car_out                 : char;
X  caract                  : char;
X
Xprocedure next_in;
X  begin
X    if eoln (source) then
X      readln (source);
X    if not eof (source) then
X      begin
X        read (source,car_in);
X        car_in := chr (uand(ord (car_in), 127));
X      end
X    else
X      car_in := ''(00);
X  end;
X
Xprocedure next_out;
X  begin
X    write (dest,car_out);
X  end;
X
X`7Bprogramme principal`7D
X  begin
X    `7Binitialisation`7D
X    writeln (titre);
X    writeln (Version);
X    writeln (auteur);
X    write ('Nom du Fichier source a convertir : ');
X    readln (source_name);
X    open (file_variable := source,
X         file_name := source_name,
X         history := readonly,
X         access_method := sequential,
X         record_type := variable);
X    reset (source);
X    write ('Nom du Fichier destination        : ');
X    readln (dest_name);
X    open (file_variable := dest,
X         file_name := dest_name,
X         history := new,
X         access_method := sequential,
X         record_type := variable);
X    rewrite (dest);
X    while not eof (source) do
X      begin
X        next_in;
X        case car_in of
X          ''(00)..''(06) : ; `7Bignore `5E@..`5EF`7D
X          ''(10)..''(11) : ; `7Bignore `5EJ..`5EK`7D
X          ''(13)         : writeln (dest);
X          ''(14)..''(26) : ; `7Bignore `5EN..`5EZ`7D
X          ''(27)         : writeln (dest); `7Bremplace ESC par EOLN`7D
X          ''(28)..''(31) : ; `7Bignore `5E\..`5E_`7D
X          ''(127)        : ; `7Bignore <DEL>`7D
X        otherwise
X          begin
X            car_out := car_in;
X            next_out;
X          end;
X        end;
X      end;
X    close (source); close (dest);
Xend.
$ CALL UNPACK READPSI.PAS;1 144663
$ create 'f'
X`09INTEGER*4 STATUS
X`09INTEGER*2 VARI
X`09CHARACTER*100 FILE
X`09character*100 filout
Xc`09CHARACTER*100 FICH
Xc`09CHARACTER*12 IUSER
X`09BYTE ITAB(100)
Xc`09INUM='00000202'X
Xc`09CALL LIB$GETJPI(INUM,,,,IUSER,)
Xc`09KK=INDEX(IUSER,' ')
Xc`09FILE='scratch:`5B'//IUSER(1:(KK-1))//'`5DTELEX.TXT'
X`09type 5
X5`09format (1x,'Nom du fichier a traduire : ',$)
X`09read (5,4) file
X`09type 6
X6`09format (1x,'Nom du fichier de sortie  : ',$)
X`09read (5,4) filout
X`09OPEN(UNIT=1,TYPE='OLD',FORM='FORMATTED',FILE=FILE,
X     SREADONLY)
X`09OPEN(UNIT=2,TYPE='NEW',FORM='FORMATTED',FILE=filout
X     S,RECORDTYPE='VARIABLE',carriagecontrol='list')
X1`09READ(1,2,END=100)NCAR,(ITAB(I),I=1,NCAR)
X2`09FORMAT(Q,100A1)
X`09ITAB(NCAR+1)=10
X`09WRITE(2,3)(ITAB(J),J=1,NCAR+1)
X3`09FORMAT(100A1)
X4`09format(a)
X`09GOTO 1
X100`09END
$ CALL UNPACK INSLF.FOR;1 1481473627
$ v=f$verify(v)
$ EXIT
-------------------- end   of psi.share_1_of_1 --------------------
        Jean-Louis Oneto
        OCA-CERGA, Avenue Copernic, 06130 Grasse - FRANCE
Bitnet : ONETO@FRONI51          SPAN : OCAR01::ONETO (17494::ONETO)
Transpac : PSI%0208006149913::ONETO / 106149913::ONETO

