
! script name: filing.d/readheader
! topic: display file header for selected file

!A
!A NAME:
!A
!A 	Read Header
!A
!A DESCRIPTION:
!A
!A 	This script brings up the FILE HEADER for a selected file.
!A
!B INSTRUCTIONS:
!B
!B 	SELECT EXISTING JOB FILE: The file selection box will appear
!B 		at this time for a selection to be made.
!B

stat=ChangeLabelStr("ScriptNameStatus","Function: read header ")

DIM Answer$[256]
DIM Destination$[256]
DIM Name$[256]
DIM Dir$[256]
DIM D_label$[256]
DIM Sub_label$[256]
DIM F_label$[256]
DIM Choice$[256]
DIM Mask$[32]
DIM Header$[4096]
DIM File$[256]
DIM Title$[256]

DeActivateUndo
Start: !
Stat= NamedVarStr("retrieve dir",WsSystemVars,"/usr/weber/ST/",Dir$)
D_label$="DIRECTORY"
Sub_label$="SUB DIRECTORIES"
F_label$="FILES"
Choice$="FILE TO OPEN"
Mask$="[A-Za-z0-9]*"

Stat=UserFileBox(Dir$,Mask$,D_label$,Sub_label$,F_label$,Choice$)
Stat=SetInputFormat("a99","")
Stat=GetValue("SELECT EXISTING JOB FILE",Answer$)
IF (ExitScript(Destination$)) THEN Leave
IF Answer$= "CANCEL" THEN Leave

Name$=Answer$

Stat= ReadHeaderOnly(Name$,Header$)

File$= "tempdata"
Stat= RemoveFile(File$)
Title$= "FILE HEADER"
stat= OutputString(File$,Header$,WsNewFile)
Stat=MessageFileBox(File$,Title$)

GOTO Start

Leave:!

LowerFileBox
Stat=SetInputFormat("n4","")

IF (NOT LEN(Destination$)) THEN
	 LOAD "typecontrol"
ELSE
	 LOAD Destination$
END IF
END


