140 lines
4.8 KiB
Plaintext
140 lines
4.8 KiB
Plaintext
subroutine data_mods_mfs(Code, BFS, Handle, Name, FMC, Record, Status)
|
|
|
|
$insert data_mods_common
|
|
$insert file.system.equates
|
|
$insert fserrors_hdr
|
|
$insert fserrors_100
|
|
$insert logical
|
|
$insert msg_equates
|
|
$insert prod_spec_log_equ
|
|
$insert prod_spec_equ
|
|
equ CrLf$ to char(13):char(10)
|
|
|
|
declare function msg, fieldcount
|
|
declare subroutine record_lock
|
|
|
|
equ DictIdsNotToSave$ to '%PROTECT.SPEC%':@fm:'%RECORDS%':@fm:'%PROTECT%':@fm:'%SK%':@fm:'%FIELDS%'
|
|
|
|
FSBranch = 'ReadRecord/ReadORecord/WriteRecord/DeleteRecord/LockRecord/UnlockRecord/Select/'
|
|
FSBranch:= 'Readnext/ClearSelect/ClearTable/OpenTable/CreateTable/RenameTable/MoveTable/'
|
|
FSBranch:= 'DeleteTable/OpenMedia/CreateMedia/ReadMedia/WriteMedia/UnlockAll/Flush/Install/'
|
|
FSBranch:= 'Reserved/Reserved/Reserved/OmniScript/CloseMedia/RecordCount/RemakeTable/'
|
|
FSBranch:= 'CreateIndex/DeleteIndex/UpdateIndex/SelectIndex/ReadnextIndex'
|
|
convert '/' to @fm in FSBranch
|
|
|
|
FS = delete(BFS,1,1,1)
|
|
NextFS = FS<1,1,1>
|
|
@file.error = ''
|
|
|
|
******** RUN SET_MFS "PROD_SPEC", "DATA_MODS_MFS*LSL2", 3
|
|
*RUN RLIST "LIST PROD_SPEC 107 CUST_NAME", 1
|
|
****Void = msg( '', Code )
|
|
on Code gosub ReadRecord, ReadORecord, WriteRecord, DeleteRecord, LockRecord, UnlockRecord, Select, Readnext, ClearSelect, ClearTable, OpenTable, CreateTable, RenameTable, MoveTable, DeleteTable, OpenMedia, CreateMedia, ReadMedia, WriteMedia, UnlockAll, Flush, Install, Reserved, Reserved, Reserved, OmniScript, CloseMedia, RecordCount, RemakeTable, CreateIndex, DeleteIndex, UpdateIndex, SelectIndex, ReadnextIndex
|
|
|
|
return
|
|
|
|
*============================ READ RECORD =========================================*
|
|
ReadRecord:
|
|
gosub nextfs
|
|
if assigned( Record ) then
|
|
OrigRecord@ = Record
|
|
end
|
|
return
|
|
*============================ WRITE RECORD ======================================*
|
|
WriteRecord:
|
|
if assigned( OrigRecord@ ) and assigned( Record ) and ( Record <> OrigRecord@ ) then
|
|
open 'PROD_SPEC_LOG' to ProdSpecLogTable else
|
|
msg( '', 'Unable to open PROD_SPEC_LOG...' )
|
|
return 0
|
|
end
|
|
record_lock( ProdSpecLogTable, 'PROD_SPEC_LOG', Name )
|
|
PSLRec = xlate( 'PROD_SPEC_LOG', Name, '', 'X' )
|
|
NCnt = fieldcount( Record, @fm )
|
|
NRecord = Record
|
|
* SINCE WE ARE CONVERTING @VM TO @SVM IN MULTIVALUED FIELDS
|
|
* WE NEED TO CONVERT THE @SVM THAT EXIST IN THE SPEC_EPI FIELD TO SOMETHING ELSE
|
|
* THE PRINT ROUTINE FROM THE PRODUCT SPECIFICATION WINDOW WILL CONVERT THEM BACK
|
|
convert @svm to '`' in NRecord
|
|
convert @svm to '`' in OrigRecord@
|
|
*convert @vm to @svm in NRecord
|
|
*convert @vm to @svm in OrigRecord@
|
|
Update = false$
|
|
for i = 1 to NCnt
|
|
if ( i <> prod_spec_mod_date$ ) and ( i <> prod_spec_mod_id$ ) then ;* DO NOT RECORD EACH MOD STAMP CHANGE
|
|
if NRecord<i> <> OrigRecord@<i> then
|
|
* NOW LOOP THROUGHT THE MULTIVALUES IF APPLICABLE
|
|
NVCnt = fieldcount( NRecord<i>, @vm )
|
|
NV2Cnt = fieldcount( OrigRecord@<i>, @vm )
|
|
if NV2Cnt > NVCnt then
|
|
NVCnt = NV2Cnt
|
|
end
|
|
for j = 1 to NVCnt
|
|
if OrigRecord@<i,j> <> NRecord<i,j> then
|
|
PSLRec<prod_spec_log_orig_values$,i,j> = OrigRecord@<i,j>
|
|
PSLRec<prod_spec_log_new_values$,i,j> = NRecord<i,j>
|
|
PSLRec<prod_spec_log_date$,i,j> = date()
|
|
PSLRec<prod_spec_log_time$,i,j> = time()
|
|
PSLRec<prod_spec_log_user_id$,i,j> = @user4
|
|
end
|
|
next j
|
|
end
|
|
Update = true$
|
|
end
|
|
next i
|
|
if Update then
|
|
write PSLRec on ProdSpecLogTable, Name else
|
|
msg( '', 'Unable to write ':Name:' on PROD_SPEC_LOG table...' )
|
|
return 0
|
|
end
|
|
end
|
|
unlock ProdSpecLogTable, Name else
|
|
msg( '', 'Unable to unlock ':Name:' on PROD_SPEC_LOG table...' )
|
|
return 0
|
|
end
|
|
end
|
|
gosub NextFS
|
|
return
|
|
*============================ INTACT BRANCHES =====================================*
|
|
DeleteRecord:
|
|
OpenTable:
|
|
Readnext:
|
|
ReadnextIndex:
|
|
CreateMedia:
|
|
OpenMedia:
|
|
ReadMedia:
|
|
WriteMedia:
|
|
CloseMedia:
|
|
ClearTable:
|
|
CreateTable:
|
|
DeleteTable:
|
|
MoveTable:
|
|
RemakeTable:
|
|
RenameTable:
|
|
ReadORecord:
|
|
Select:
|
|
ClearSelect:
|
|
LockRecord:
|
|
UnlockRecord:
|
|
UpdateIndex:
|
|
SelectIndex:
|
|
CreateIndex:
|
|
DeleteIndex:
|
|
Reserved:
|
|
OmniScript:
|
|
RecordCount:
|
|
NextFS:
|
|
call @nextfs(Code, FS, Handle, Name, FMC, Record, Status)
|
|
return
|
|
*============================================================================
|
|
/*
|
|
Install, unlock all and flush are called directly, no need to call next FS.
|
|
*/
|
|
Install:
|
|
Flush:
|
|
UnlockAll:
|
|
|
|
Status = TRUE$
|
|
|
|
return
|
|
*============================================================================*
|