Parse-O-Matic
Home Sitemap
 

About the PSKB / Terms of Use


Installing and running a script


;=============================================================================== ; ; Translate files from EBCDIC to ASCII and vice-versa. ; ; Please note that translating character sets is fraught with peril. ; This particular script converts ASCII ISO-8859-1 to EBCDIC Latin-1 ; (or vice-versa) but these are not the only incarnations of ASCII ; and EBCDIC. They are, however, very commonly used, so this script ; should work in many situations. ; ; Even with two such well-defined character sets, it is not always ; clear how to translate certain things such as the control characters. ; Thus, this script may work fine in some situations but it could also ; produce output that upsets your printer. In that case, you might ask ; us about "Carriage Control" characters, Unicode equivalences for the ; EBCDIC control codes etc. (We can't help out for free, though.) ; ;=============================================================================== ; Config Section ;=============================================================================== Config $CfgEnableOptionX = 'Y' $CfgCaptionX = '&To code' $CfgHintX = 'Translate to: A = ASCII; E = EBCDIC' $CfgEnableOptionY = 'N' $CfgEnableOptionZ = 'N' $CfgInpFileType = 'Binary' $CfgRecLen = 255 ; This number is fairly arbitrary $CfgCopyright = 'Copyright 2005 by Pinnacle Software (Toronto)' $CfgVersion = '1.00.00' $CfgProgrammer = 'Timothy Campbell' $CfgEmail = 'info' $40 'parse-o-matic.com' ; Note anti-spam tactic $CfgLicense = 'This script may be used by anyone who has a valid ' >> 'Advanced Scripting License from Pinnacle Software ' >> '(Toronto), or is evaluating one of our ' >> 'Parse-O-Matic products (for up to 30 days).' End ;=============================================================================== ; TaskInit Step ;=============================================================================== TaskInit TranslateTo = $OptionX ;----------------------------------------------------------------------------- ; Hex values from $00 to $0F ;----------------------------------------------------------------------------- Ordinal_Value = >> $00 $01 $02 $03 $04 $05 $06 $07 $08 $09 $0A $0B $0C $0D $0E $0F >> $10 $11 $12 $13 $14 $15 $16 $17 $18 $19 $1A $1B $1C $1D $1E $1F >> $20 $21 $22 $23 $24 $25 $26 $27 $28 $29 $2A $2B $2C $2D $2E $2F >> $30 $31 $32 $33 $34 $35 $36 $37 $38 $39 $3A $3B $3C $3D $3E $3F >> $40 $41 $42 $43 $44 $45 $46 $47 $48 $49 $4A $4B $4C $4D $4E $4F >> $50 $51 $52 $53 $54 $55 $56 $57 $58 $59 $5A $5B $5C $5D $5E $5F >> $60 $61 $62 $63 $64 $65 $66 $67 $68 $69 $6A $6B $6C $6D $6E $6F >> $70 $71 $72 $73 $74 $75 $76 $77 $78 $79 $7A $7B $7C $7D $7E $7F >> $80 $81 $82 $83 $84 $85 $86 $87 $88 $89 $8A $8B $8C $8D $8E $8F >> $90 $91 $92 $93 $94 $95 $96 $97 $98 $99 $9A $9B $9C $9D $9E $9F >> $A0 $A1 $A2 $A3 $A4 $A5 $A6 $A7 $A8 $A9 $AA $AB $AC $AD $AE $AF >> $B0 $B1 $B2 $B3 $B4 $B5 $B6 $B7 $B8 $B9 $BA $BB $BC $BD $BE $BF >> $C0 $C1 $C2 $C3 $C4 $C5 $C6 $C7 $C8 $C9 $CA $CB $CC $CD $CE $CF >> $D0 $D1 $D2 $D3 $D4 $D5 $D6 $D7 $D8 $D9 $DA $DB $DC $DD $DE $DF >> $E0 $E1 $E2 $E3 $E4 $E5 $E6 $E7 $E8 $E9 $EA $EB $EC $ED $EE $EF >> $F0 $F1 $F2 $F3 $F4 $F5 $F6 $F7 $F8 $F9 $FA $FB $FC $FD $FE $FF ;----------------------------------------------------------------------------- ; Translation table to convert ISO-8859-1 to Latin-1 (i.e. ASCII to EBCDIC) ;----------------------------------------------------------------------------- ISO_8859_1_to_E_Latin_1 = >> $00 $01 $02 $03 $37 $2D $06 $2F $16 $05 $25 $0B $0C $0D $0E $0F >> ; 00-0F $10 $11 $12 $13 $14 $3D $32 $26 $18 $19 $3F $27 $1C $1D $1E $1F >> ; 10-1F $40 $5A $7F $7B $5B $6C $50 $7D $4D $5D $5C $4E $6B $60 $4B $61 >> ; 20-2F $F0 $F1 $F2 $F3 $F4 $F5 $F6 $F7 $F8 $F9 $7A $5E $4C $7E $6E $6F >> ; 30-3F $7C $C1 $C2 $C3 $C4 $C5 $C6 $C7 $C8 $C9 $D1 $D2 $D3 $D4 $D5 $D6 >> ; 40-4F $D7 $D8 $D9 $E2 $E3 $E4 $E5 $E6 $E7 $E8 $E9 $AD $E0 $BD $5F $6D >> ; 50-5F $79 $81 $82 $83 $84 $85 $86 $87 $88 $89 $91 $92 $93 $94 $95 $96 >> ; 60-6F $97 $98 $99 $A2 $A3 $A4 $A5 $A6 $A7 $A8 $A9 $C0 $4F $D0 $A1 $07 >> ; 70-7F $80 $81 $82 $83 $84 $85 $86 $87 $88 $89 $8A $8B $8C $8D $8E $8F >> ; 80-8F $90 $91 $92 $93 $94 $95 $96 $97 $98 $99 $9A $9B $9C $9D $9E $9F >> ; 90-9F $20 $AA $4A $B1 $9F $B2 $6A $B5 $BB $B4 $9A $8A $B0 $60 $AF $BC >> ; A0-AF $90 $8F $EA $FA $7D $A0 $B6 $B3 $9D $DA $9B $8B $B7 $B8 $B9 $AB >> ; B0-BF $64 $65 $62 $66 $63 $67 $9E $68 $74 $71 $72 $73 $78 $75 $76 $77 >> ; C0-CF $AC $69 $ED $EE $EB $EF $EC $BF $80 $FD $FE $FB $FC $BA $8E $59 >> ; D0-DF $44 $45 $42 $46 $43 $47 $9C $48 $54 $51 $52 $53 $58 $55 $56 $57 >> ; E0-EF $8C $49 $CD $CE $CB $CF $CC $E1 $70 $DD $DE $DB $DC $8D $AE $DF ; F0-FF ;----------------------------------------------------------------------------- ; Translation table to convert Latin-1 to ISO-8859-1 (i.e. EBCDIC to ASCII) ;----------------------------------------------------------------------------- E_Latin_1_to_ISO_8859_1 = >> $00 $01 $02 $03 $04 $09 $06 $7F $08 $09 $0A $0B $0C $0D $0E $0F >> ; 00-0F $10 $11 $12 $13 $14 $0A $08 $17 $18 $19 $1A $1B $1C $1D $1E $1F >> ; 10-1F $20 $21 $1C $23 $24 $0A $17 $1B $28 $29 $2A $2B $2C $05 $06 $07 >> ; 20-2F $30 $31 $16 $0D $34 $35 $36 $04 $38 $09 $0C $3B $14 $15 $3E $1A >> ; 30-3F $20 $A0 $E2 $E4 $E0 $E1 $E3 $E5 $E7 $F1 $A2 $2E $3C $28 $2B $7C >> ; 40-4F $26 $E9 $EA $EB $E8 $ED $EE $EF $EC $DF $21 $24 $2A $29 $3B $5E >> ; 50-5F $2D $2F $C2 $C4 $C0 $C1 $C3 $C5 $C7 $D1 $A6 $2C $25 $5F $3E $3F >> ; 60-6F $F8 $C9 $CA $CB $C8 $CD $CE $CF $CC $60 $3A $23 $40 $27 $3D $22 >> ; 70-7F $D8 $61 $62 $63 $64 $65 $66 $67 $68 $69 $AB $BB $F0 $FD $FE $B1 >> ; 80-8F $B0 $6A $6B $6C $6D $6E $6F $70 $71 $72 $AA $BA $E6 $B8 $C6 $A4 >> ; 90-9F $B5 $7E $73 $74 $75 $76 $77 $78 $79 $7A $A1 $BF $D0 $5B $DE $AE >> ; A0-AF $AC $A3 $A5 $B7 $A9 $A7 $B6 $BC $BD $BE $DD $A8 $AF $5D $B4 $D7 >> ; B0-BF $7B $41 $42 $43 $44 $45 $46 $47 $48 $49 $AD $F4 $F6 $F2 $F3 $F5 >> ; C0-CF $7D $4A $4B $4C $4D $4E $4F $50 $51 $52 $B9 $FB $FC $F9 $FA $FF >> ; D0-DF $5C $F7 $53 $54 $55 $56 $57 $58 $59 $5A $B2 $D4 $D6 $D2 $D3 $D5 >> ; E0-EF $30 $31 $32 $33 $34 $35 $36 $37 $38 $39 $B3 $DB $DC $D9 $DA $FF ; F0-FF If 'AE' ~ TranslateTo Stop 'Please set the To value to A or E' If TranslateTo = 'E' Translate_Table = ISO_8859_1_to_E_Latin_1 If TranslateTo = 'A' Translate_Table = E_Latin_1_to_ISO_8859_1 End ;=============================================================================== ; Main Step ;=============================================================================== Cntr = 0 Begin $Data Len> Cntr Inc Cntr Char = Cols $Data Cntr FindChar = '1*' Char OrdVal = FindPosn Ordinal_Value FindChar 'MatchCase' NewChar = Cols Translate_Table OrdVal Overlay $Data Cntr NewChar Again Output $Data




 

Parse-O-Matic Free, Basic, Business and Enterprise are data conversion tools that allow you to parse, convert, mine, import and export data files, reports, web capture, logs, legacy databases, text, CSV (comma separated; comma delimited), ASCII, EBCDIC, and almost any data format that you may have.

Copyright © 1986-2011 National Data Parsing Canada Corporation All rights reserved. Legal