项目作者: danielefdf

项目描述 :
A tool for visualizing fixed format files from mainframe
高级语言: REXX
项目地址: git://github.com/danielefdf/blip.git
创建时间: 2020-11-10T00:36:17Z
项目社区:https://github.com/danielefdf/blip

开源协议:MIT License

下载


blip

A command-line tool for visualizing fixed format files from mainframe.

On the mainframe it may happen to come across fixed format files, i.e. files in which data is written in this way:

  1. 01NAME1 SURNAME101/01/0001
  2. 02NAME2 SURNAME202/01/0001
  3. 03NAME3 SURNAME303/01/0001

Everything is simple until you find files in which the records are defined differently (see CoBOL REDEFINE) according to one or more reference fields: in this case it is not easy to read the file, especially if there are many redefinitions and many records.

This tool allows you to interpret the data, given the reference CoBOL structure.

use of the tool

For example, let’s define the data and the reference CoBOL copy as follows:

  • data

    1. a01xyz00abcdef.
    2. a02xyz10abbccc.
    3. a03xyz21aa@@@b.
    4. a04xyz22@@@@@@.
    5. a05xyz30aaab@@.
    6. a06xyz10deefff.
    7. a07xyz21cc@@@d.
    8. a08xyz22@@@@@@.
    9. a09xyz10ghhiii.
    10. a10xyz30cccd@@.
    11. a11xyz30eeef@@.
    12. a12xyz30gggh@@.
    13. a13xyz30iiij@@.
    14. a14xyz90abcdef.

    ON MAINFRAMES

    • files must be in native EBCDIC encoding

      ON WINDOWS

    • plain data files can be in ASCII encoding
    • files with signed, comp, comp-3 fields must be in EBCDIC encoding (binary transfer)
  • copy

    1. 01 field01.
    2. 03 rec-header.
    3. 01-01 05 rec-header-field-01 pic x(1).
    4. 02-03 05 rec-header-field-02 pic x(2).
    5. 04-06 05 rec-header-field-03 pic x(3).
    6. 07-07 03 rec-type pic x(1).
    7. 88 rec-type-1 value '1'.
    8. 88 rec-type-2 value '2'.
    9. 88 rec-type-3 value '3'.
    10. 08-08 03 rec-subtype pic x(1).
    11. 88 rec-subtype-0 value '0'.
    12. 88 rec-subtype-1 value '1'.
    13. 88 rec-subtype-2 value '2'.
    14. 09-14 03 rec-body pic x(6).
    15. 09-14 03 rec-body-01
    16. redefines rec-body.
    17. 05 rec-body-01-field-01 pic x(1).
    18. 05 rec-body-01-field-02 pic x(2).
    19. 05 rec-body-01-field-03 pic x(3).
    20. 09-14 03 rec-body-02-01
    21. redefines rec-body.
    22. 05 rec-body-02-01-field-02 pic x(2).
    23. 05 filler pic x(3).
    24. 05 rec-body-02-01-field-01 pic x(1).
    25. 09-14 03 rec-body-02-02
    26. redefines rec-body pic x(6).
    27. 09-14 03 rec-body-03
    28. redefines rec-body.
    29. 05 rec-body-03-field-03 pic x(3).
    30. 05 rec-body-03-field-01 pic x(1).
    31. 05 filler pic x(2).
    32. 15-15 03 rec-footer pic x(1).

At start, the tool shows this menu:

  1. blip> enter command:
  2. e: edit console
  3. c: view copy
  4. d: view data...
  5. x: exit blip
  • e shows a file with the parms for the tool

    1. *
    2. * file data
    3. * dataset
    4. C:\ ... blip\data\example1.ascii
    5. * ebcdic/ascii
    6. ascii
    7. * lseq/seq
    8. lseq
    9. *
    10. * file copy
    11. * dataset
    12. C:\ ... blip\data\example1.cpy
    13. *
    14. * options
    15. * max number of records
    16. 99
    17. * max length for alphanumeric fields
    18. 99
    19. * restart record cursor for level
    20. 99
    21. *
    22. *
    23. *

    The dataset and the copy can be set here.

    • lseq means that every record in the dataset terminates with a newline char (seq means the opposite).

      The presence of the newline char depends on what type of file-transfer is used.

  • c shows the copy as interpreted by the tool:

    1. ;level;label ;picture ; occurs;redefines ; int; dec; from; to; len;structure ;
    2. ; ; ; ; ; ; ; ; ; ; ; ;
    3. ; 1;field01 ;GROUP ; ; ; 0; 0; 1; 15; 15; |01 ;
    4. ; 3;rec-header ;GROUP ; ; ; 0; 0; 1; 6; 6; | |03 ;
    5. ; 5;rec-header-field-01 ;x ; ; ; 1; 0; 1; 1; 1; | | |05 ;
    6. ; 5;rec-header-field-02 ;x(2) ; ; ; 2; 0; 2; 3; 2; | | |05 ;
    7. ; 5;rec-header-field-03 ;x(3) ; ; ; 3; 0; 4; 6; 3; | | |05 ;
    8. ; 3;rec-type ;x ; ; ; 1; 0; 7; 7; 1; | |03 ;
    9. ; 3;rec-subtype ;x ; ; ; 1; 0; 8; 8; 1; | |03 ;
    10. ; 3;rec-body ;x(6) ; ; ; 6; 0; 9; 14; 6; | |03 ;
    11. ; 3;rec-body-01 ;GROUP ; ;rec-body ; 0; 0; 9; 14; 6; | |03 ;
    12. ; 5;rec-body-01-field-01 ;x ; ; ; 1; 0; 9; 9; 1; | | |05 ;
    13. ; 5;rec-body-01-field-02 ;x(2) ; ; ; 2; 0; 10; 11; 2; | | |05 ;
    14. ; 5;rec-body-01-field-03 ;x(3) ; ; ; 3; 0; 12; 14; 3; | | |05 ;
    15. ; 3;rec-body-02-01 ;GROUP ; ;rec-body ; 0; 0; 9; 14; 6; | |03 ;
    16. ; 5;rec-body-02-01-field-02 ;x(2) ; ; ; 2; 0; 9; 10; 2; | | |05 ;
    17. ; 5;filler-(1) ;x(3) ; ; ; 3; 0; 11; 13; 3; | | |05 ;
    18. ; 5;rec-body-02-01-field-01 ;x ; ; ; 1; 0; 14; 14; 1; | | |05 ;
    19. ; 3;rec-body-02-02 ;x(6) ; ;rec-body ; 6; 0; 9; 14; 6; | |03 ;
    20. ; 3;rec-body-03 ;GROUP ; ;rec-body ; 0; 0; 9; 14; 6; | |03 ;
    21. ; 5;rec-body-03-field-03 ;x(3) ; ; ; 3; 0; 9; 11; 3; | | |05 ;
    22. ; 5;rec-body-03-field-01 ;x ; ; ; 1; 0; 12; 12; 1; | | |05 ;
    23. ; 5;filler-(2) ;x(2) ; ; ; 2; 0; 13; 14; 2; | | |05 ;
    24. ; 3;rec-footer ;x ; ; ; 1; 0; 15; 15; 1; | |03 ;
    • d opens a submenu:

      1. blip> viewData> enter command:
      2. r: select records...
      3. c: select columns...
      4. v: view data
      5. m: return to parent menu
      6. x: exit blip

Here, r and c allow you to filter the rows and columns to be displayed, and to set the criteria for which a certain REDEFINE must be used for a given condition.

In the example, let’s say we filter the rows as follows:

  1. field ------------------------------------- query
  2. ALL FIELDS [][]
  3. field01. [][]
  4. rec-header. [][]
  5. rec-header-field-01 [][]
  6. rec-header-field-02 [][]
  7. rec-header-field-03 [][]
  8. rec-type [>][1]
  9. rec-subtype [][]
  10. rec-body [][]
  11. rec-body-01. [][]
  12. rec-body-01-field-01 [][]
  13. rec-body-01-field-02 [][]
  14. rec-body-01-field-03 [][]
  15. rec-body-02-01. [][]
  16. rec-body-02-01-field-02 [][]
  17. filler-(1) [][]
  18. rec-body-02-01-field-01 [][]
  19. rec-body-02-02 [][]
  20. rec-body-03. [][]
  21. rec-body-03-field-03 [][]
  22. rec-body-03-field-01 [][]
  23. filler-(2) [][]
  24. rec-footer [][]

And let’s say we define the columns as follows:

  1. when [rec-type][=][01]
  2. show [rec-header]
  3. and [rec-type]
  4. and [rec-body-01]
  5. and [rec-footer]
  6. when [rec-type][=][02]
  7. and [rec-subtype][=][01]
  8. show [rec-header]
  9. and [rec-type]
  10. and [rec-body-02-01]
  11. and [rec-footer]
  12. when [rec-type][=][02]
  13. and [rec-subtype][=][02]
  14. show [rec-header]
  15. and [rec-type]
  16. and [rec-body-02-02]
  17. and [rec-footer]
  18. when [rec-type][=][03]
  19. show [rec-header]
  20. and [rec-type]
  21. and [rec-body-03]
  22. and [rec-footer]
  23. default
  24. show [*]

With v, the tool provides a report as follows:

  1. rec ; rec ; rec ; rec ; rec ; filler ; rec ; rec ;
  2. header ; header ; header ; type ; body ; (1) ; body ; footer ;
  3. field ; field ; field ; ; 02 ; ; 02 ; ;
  4. 01 ; 02 ; 03 ; ; 01 ; ; 01 ; ;
  5. ; ; ; ; field ; ; field ; ;
  6. ; ; ; ; 02 ; ; 01 ; ;
  7. ; ; ; ; ; ; ; ;
  8. a ; 03 ; xyz ; 2 ; aa ; @@@ ; b ; . ;
  9. rec ; rec ; rec ; rec ; rec ; rec ;
  10. header ; header ; header ; type ; body ; footer ;
  11. field ; field ; field ; ; 02 ; ;
  12. 01 ; 02 ; 03 ; ; 02 ; ;
  13. ; ; ; ; ; ;
  14. ; ; ; ; ; ;
  15. ; ; ; ; ; ;
  16. a ; 04 ; xyz ; 2 ; @@@@@@ ; . ;
  17. rec ; rec ; rec ; rec ; rec ; rec ; filler ; rec ;
  18. header ; header ; header ; type ; body ; body ; (2) ; footer ;
  19. field ; field ; field ; ; 03 ; 03 ; ; ;
  20. 01 ; 02 ; 03 ; ; field ; field ; ; ;
  21. ; ; ; ; 03 ; 01 ; ; ;
  22. ; ; ; ; ; ; ; ;
  23. ; ; ; ; ; ; ; ;
  24. a ; 05 ; xyz ; 3 ; aaa ; b ; @@ ; . ;
  25. rec ; rec ; rec ; rec ; rec ; filler ; rec ; rec ;
  26. header ; header ; header ; type ; body ; (1) ; body ; footer ;
  27. field ; field ; field ; ; 02 ; ; 02 ; ;
  28. 01 ; 02 ; 03 ; ; 01 ; ; 01 ; ;
  29. ; ; ; ; field ; ; field ; ;
  30. ; ; ; ; 02 ; ; 01 ; ;
  31. ; ; ; ; ; ; ; ;
  32. a ; 07 ; xyz ; 2 ; cc ; @@@ ; d ; . ;
  33. rec ; rec ; rec ; rec ; rec ; rec ;
  34. header ; header ; header ; type ; body ; footer ;
  35. field ; field ; field ; ; 02 ; ;
  36. 01 ; 02 ; 03 ; ; 02 ; ;
  37. ; ; ; ; ; ;
  38. ; ; ; ; ; ;
  39. ; ; ; ; ; ;
  40. a ; 08 ; xyz ; 2 ; @@@@@@ ; . ;
  41. rec ; rec ; rec ; rec ; rec ; rec ; filler ; rec ;
  42. header ; header ; header ; type ; body ; body ; (2) ; footer ;
  43. field ; field ; field ; ; 03 ; 03 ; ; ;
  44. 01 ; 02 ; 03 ; ; field ; field ; ; ;
  45. ; ; ; ; 03 ; 01 ; ; ;
  46. ; ; ; ; ; ; ; ;
  47. ; ; ; ; ; ; ; ;
  48. a ; 10 ; xyz ; 3 ; ccc ; d ; @@ ; . ;
  49. a ; 11 ; xyz ; 3 ; eee ; f ; @@ ; . ;
  50. a ; 12 ; xyz ; 3 ; ggg ; h ; @@ ; . ;
  51. a ; 13 ; xyz ; 3 ; iii ; j ; @@ ; . ;
  52. rec ; rec ; rec ; rec ; rec ; rec ; rec ; rec ; rec ; rec ; filler ; rec ; rec ; rec ; rec ; filler ; rec ;
  53. header ; header ; header ; type ; subtype ; body ; body ; body ; body ; body ; (1) ; body ; body ; body ; body ; (2) ; footer ;
  54. field ; field ; field ; ; ; ; 01 ; 01 ; 01 ; 02 ; ; 02 ; 02 ; 03 ; 03 ; ; ;
  55. 01 ; 02 ; 03 ; ; ; ; field ; field ; field ; 01 ; ; 01 ; 02 ; field ; field ; ; ;
  56. ; ; ; ; ; ; 01 ; 02 ; 03 ; field ; ; field ; ; 03 ; 01 ; ; ;
  57. ; ; ; ; ; ; ; ; ; 02 ; ; 01 ; ; ; ; ; ;
  58. ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ;
  59. a ; 14 ; xyz ; 9 ; 0 ; abcdef ; a ; bc ; def ; ab ; cde ; f ; abcdef ; abc ; d ; ef ; . ;

In this example, the last record doesn’t match any criteria, so all fields of the copy are shown.

This repository is licensed under MIT (c) 2020 GitHub, Inc.