EBCDIC to ASCII conversion with 3 copybooks

Get help with installation and running here.

Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators

Post Reply
sergio_sawae
Posts: 4
Joined: Fri Jan 13, 2012 3:54 am

EBCDIC to ASCII conversion with 3 copybooks

Post by sergio_sawae »

Hi,
How can i make a conversion of EBCDIC to ASCII of a mainframe archive with Comp-3 fields?
This archive has 3 types of different layouts. Header, detail and plans.
How can i use 3 copybooks at the same archive?
I got sucess to convert an archive that has only one layout, but 3, i don't know how to do it
Thanks
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: EBCDIC to ASCII conversion with 3 copybooks

Post by DataMystic Support »

Hi Sergio,

There is an example filter included in TextPipe's mainframe folder, called split mainframe record types-variable length.fll

It demonstrates how to split the files using a series of patterns, and send different record types to different files.
sergio_sawae
Posts: 4
Joined: Fri Jan 13, 2012 3:54 am

Re: EBCDIC to ASCII conversion with 3 copybooks

Post by sergio_sawae »

Thanks for the reply.
More one doubt.
How can i use the EasyPattern to separate a record from other.
The difference from one record to other is a field named PLAN-ID that start in the position 19 and ends on the position 24.
One record is completed with EBCDIC Null caracteres and the other record is not Null.
Thanks.
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: EBCDIC to ASCII conversion with 3 copybooks

Post by DataMystic Support »

Assuming a fixed record length of 4000 characters for both record types, for the main EasyPattern, you should use:

Code: Select all

[ 
  TextStart,
  18 chars,
  (6 asc(0), 3976 chars)    
    or
  (6 not asc(0), 3976 chars)    
]
and the first record pattern (header) should be:

Code: Select all

[ 
  TextStart,
  18 chars,
  (6 asc(0), 3976 chars)    
]
and the second record (detail) pattern should be:

Code: Select all

[ 
  TextStart,
  18 chars,
  (6 not asc(0), 3976 chars)    
]
Note - you have not provided any detail on the third copybook - what is PLAN-ID set to for this record type?
sergio_sawae
Posts: 4
Joined: Fri Jan 13, 2012 3:54 am

Re: EBCDIC to ASCII conversion with 3 copybooks

Post by sergio_sawae »

Hi,

I´ve noticed that using EasyPattern, i have to replace the text found for something.
But what i want is just separate one record from an other.

I used the filter Restrict to lines matching perl pattern but it's not working.
Header has 1563 bytes and Detail has 824 bytes.
The charactere that distinguish one record form an other is EBCDIC SPACE and not EBCDIC Null as i wrote before.
Restrict to lines matching perl pattern .{18}[6 EBCDIC('SPACE')].{1543}
header copybook
header output file
Restrict to lines matching perl pattern .{18}[6 EBCDIC('SPACE')].{800}
detail copybook
detail output file

What am i doing wrong?
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: EBCDIC to ASCII conversion with 3 copybooks

Post by DataMystic Support »

You're mixing EasyPattern and perl matching patterns, and don't have the syntax right for EasyPatterns.

Try using these EasyPatterns - ensure you have no leading or trailing spaces:

[ 18 chars, 6 EBCDIC(' '), 1539 chars ]
[ 18 chars, 6 not EBCDIC(' '), 800 chars ]

Please email us your filter if you need more help.
sergio_sawae
Posts: 4
Joined: Fri Jan 13, 2012 3:54 am

Re: EBCDIC to ASCII conversion with 3 copybooks

Post by sergio_sawae »

Hi,

Using these EasyPatthern, I was able to separate the files.
[ 18 chars, 6 EBCDIC(' '), 1539 chars ]
[ 18 chars, 6 not EBCDIC(' '), 800 chars ]

But at the header copybook there is a field that is COMP on position 52.
STMT-ONLINE-REC-NBR PIC S9(8) COMP

How can i treat this on EasyPatterns?
[ 18 chars, 6 EBCDIC(' '), 31 chars, 4 bytes, 1539 chars ], something like this?

Thanks,
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: EBCDIC to ASCII conversion with 3 copybooks

Post by DataMystic Support »

The field type is irrelevant to the EasyPattern - all we are doing at this stage is separating records based on record length and the code in one field. After that, the copybook takes over with the matched data.
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: EBCDIC to ASCII conversion with 3 copybooks

Post by DataMystic Support »

Here is the overall structure (I have emailed this to you)

Code: Select all

EasyPattern [[ \r\n  (2 not asc(0), 16 chars, 6 not EBCDIC(' '), 800 chars)\r\n   or\r\n  (2 not asc(0), 16 chars, 6 EBCDIC(' '), 1539 chars)\r\n]] with []
|  [ ] Match case
|  [ ] Whole words only
|  [ ] Case sensitive replace
|  [ ] Prompt on replace
|  [ ] Skip prompt if identical
|  [ ] First only
|  [ ] Extract matches
|  Maximum text buffer size 4096
|
|--EasyPattern [[ (2 not ASC(0), 16 chars, 6 not EBCDIC(' '), 800 chars) ]] with []
|  |  [ ] Match case
|  |  [ ] Whole words only
|  |  [ ] Case sensitive replace
|  |  [ ] Prompt on replace
|  |  [ ] Skip prompt if identical
|  |  [ ] First only
|  |  [ ] Extract matches
|  |  Maximum text buffer size 4096
|  |
|  |--Mainframe Copybook [..for header...]
|  |   
|  +--Output to file(s)
|        [ ] Only update date on changed files
|        [X] Append mode
|        [X] Change extension to: _Plan.xml
|        [ ] Open output file
|      Only output modified files|      Backup mode|        Output folder: C:\Fidelity\XML
|        [X] Maintain folder structure
|        [X] Ignore start folder|        [ ] Remove empty output files|      
+--EasyPattern [[ (2 not ASC(0), 16 chars, 6 EBCDIC(' '), 1539 chars) ]] with []
   |  [ ] Match case
   |  [ ] Whole words only
   |  [ ] Case sensitive replace
   |  [ ] Prompt on replace
   |  [ ] Skip prompt if identical
   |  [ ] First only
   |  [ ] Extract matches
   |  Maximum text buffer size 4096
   |
   |--Mainframe Copybook [...for detail....]
   |   
   +--Output to file(s)
         [ ] Only update date on changed files
         [X] Append mode
         [X] Change extension to: _header.xml
         [ ] Open output file
       Only output modified files       Backup mode         Output folder: C:\Fidelity\XML
         [X] Maintain folder structure
         [X] Ignore start folder         [ ] Remove empty output files       
Post Reply