我如何...在c#或其他可视化工作室语言中使用cobol数据集定义文件? [英] How do I...use cobol dataset definition of a file in a c# or other visual studio language?

查看:177
本文介绍了我如何...在c#或其他可视化工作室语言中使用cobol数据集定义文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想处理一个大型文本文件,该文件由c#或其他可视工作室语言中的大型机上的cobol数据集定义创建。我不想使用Cobol。我想使用C#或其他视觉工作室程序中文件的Cobol数据集定义



A 333 BANKIE BANK FSB -333 PO BOX 1234 CANTON OH 44711 3304445555

B 1111111 JON A SAMSONS 222 MAIN ST DRIVE SUNBERRYS TOWNSHIP PA 16166 4403334444 0 JOHNSTUT@BNTMINTERNET.NET SANDERA A SAMSONSUA 222 MAIN ST DRIVE SOONBERRY TOWNSHIP KZ 16666 724-777-0140 0

D 1111111 222 AFTERNOON DR SOONBERRY TOWNSHIP KZ 16666 USA 19 12 1 07-01-1997 99500 99500 07-01-1997

F 1111111 2 8 FR4421888660729203 00/00 / 0000 1997年7月11日1997年9月1日07月01日00/00/0000 2 98949.00 6.50000 625.42 360 2027年8月1日2.62500 360 2027年8月1日469.81 308.42 31.31 61368.00 778.51 + 2014年11月1日 - 14.02 + + + + 826.08 0 1 15 7 N 2 4.000 00/00/0000 9999.99 2014年10月1日2014年11月1日2014年10月16日2014年10月17日283 0 + + 2121.23 + 2749.67 + 4937.47 + 4875.57 + 582.27 + 5454.05 1 00/00/0000 + + + + N 00/00/0000 00/00/0000 00/00/0000 00 / 00/0000Ñ00/00/0000 00/00/0000 00/00/0000 00/00/0000Ñ00/00/0000 00/00/0000 00/00/0000 00/00/0000Ñ00/00 / 0000 00/00/0000 00/00/0000 00/00/0000 C 0 0000000000 0000000000 00/00/0000

G 1111111 120500 GHA 1 YR ADJ 1/5 DAPS 00/00/0000 00/00/0000 + 2.50000 + 99.99999 10/01/2014 2.62500 08/25/2014 0.11000 0000000000 10/01/2015 11/01/2013 00000469.81 11/01/2015 0000000000 08/01/2027

H 1111111 120500 GHA 1 YR ADJ 1/5 DAPS 7010 1年美国财政山区女性保护区RTAT BELEASE 12 12 1.00000 1.00000 5.00000 1.00000 1.00000 99.99999 12 12 99.99999 99.99999 99.99999 99.99999 99.99999 99.99999 206 24 30

I 1111111 11 12 1 A MARIANNE JOHNESON 800-333-1777 00/00/0000 0 11/14/2014 C 00/00/0000 05/02/2014 04/11/2014 00/00/0000 00/00 / 0000

K 1111111 11-10-2014 11 6 6 6 5 4 3 3 2 1。 。 。 1 1 2 0 1 2 3 4 5 6 6 5。 。 。 。 。 。 。 。 。 2 0 1 00/00/0000

M 1111111 11-14-2014 5027 + + + + + + + + + DM联系客户改为R

M 1111111 11-14-2014 5027 + + + + + + + + + + DM MS CLD SD将在星期一分支。 GAVE CELL PH#与她联系#777-777-4144。 BLM 11/14/14

M 1111111 11-14-2014 5027 + + + + + + + + + DM ACTION / RESULT CD从BRQL更改为BOQL

I want to process a large text file that was created by a cobol dataset definition on a mainframe in a c# or other visual studio language. I don't want to use Cobol. I want to use the Cobol dataset definition of the file from my C# or other visual studio program

A 333 BANKIE BANK FSB -333 PO BOX 1234 CANTON OH 44711 3304445555
B 1111111 JON A SAMSONS 222 MAIN ST DRIVE SUNBERRYS TOWNSHIP PA 16166 4403334444 0 JOHNSTUT@BNTMINTERNET.NET SANDERA A SAMSONSUA 222 MAIN ST DRIVE SOONBERRY TOWNSHIP KZ 16666 724-777-0140 0
D 1111111 222 AFTERNOON DR SOONBERRY TOWNSHIP KZ 16666 USA 19 12 1 07-01-1997 99500 99500 07-01-1997
F 1111111 2 8 FR4421888660729203 00/00/0000 07/11/1997 09/01/1997 07/01/2012 00/00/0000 2 98949.00 6.50000 625.42 360 08/01/2027 2.62500 360 08/01/2027 469.81 308.42 31.31 61368.00 + 778.51 11/01/2014 - 14.02 + + + + 826.08 0 1 15 7 N 2 4.000 00/00/0000 9999.99 10/01/2014 11/01/2014 10/16/2014 10/17/2014 283 0 + + 2121.23 + 2749.67 + 4937.47 + 4875.57 + 582.27 + 5454.05 1 00/00/0000 + + + + N 00/00/0000 00/00/0000 00/00/0000 00/00/0000 N 00/00/0000 00/00/0000 00/00/0000 00/00/0000 N 00/00/0000 00/00/0000 00/00/0000 00/00/0000 N 00/00/0000 00/00/0000 00/00/0000 00/00/0000 C 0 0000000000 0000000000 00/00/0000
G 1111111 120500 GHA 1 YR ADJ 1/5 DAPS A 00/00/0000 00/00/0000 + 2.50000 + 99.99999 10/01/2014 2.62500 08/25/2014 0.11000 0000000000 10/01/2015 11/01/2013 00000469.81 11/01/2015 0000000000 08/01/2027
H 1111111 120500 GHA 1 YR ADJ 1/5 DAPS 7010 1-YEAR US TREASURY HILL FEMERAL DESERVE RTAT BELEASE 12 12 1.00000 1.00000 5.00000 1.00000 1.00000 99.99999 12 12 99.99999 99.99999 99.99999 99.99999 99.99999 99.99999 206 24 30
I 1111111 11 12 1 A MARIANNE JOHNESON 800-333-1777 00/00/0000 0 11/14/2014 C 00/00/0000 05/02/2014 04/11/2014 00/00/0000 00/00/0000
K 1111111 11-10-2014 11 6 6 6 5 4 3 3 2 1 . . . 1 1 2 0 1 2 3 4 5 6 6 5 . . . . . . . . . 2 0 1 00/00/0000
M 1111111 11-14-2014 5027 + + + + + + + + + DM CONTACT WITH CUSTOMER CHANGED TO R
M 1111111 11-14-2014 5027 + + + + + + + + + DM MS CLD SD SHE WILL TAKE TO BRANCH ON MONDAY. GAVE CELL PH # TO CONTACT HER #777-777-4144. BLM 11/14/14
M 1111111 11-14-2014 5027 + + + + + + + + + DM ACTION/RESULT CD CHANGED FROM BRQL TO BOQL

推荐答案

我们采用的方法是将数据集定义下载为ascii文件。



然后我们将它(作为文本)解析为字典。从那里我们创建了类来保存文件中的数据,但XML模式可以做 - 这是一个棘手的部分或简单的部分,具体取决于您的具体要求(而不是我可以在这个论坛中正确扩展的东西)。



使用本CP文章中的技巧 - EBCDIC到ASCII转换器 [ ^ ]然后我们将文件转换为ASCII(从而转换为XML)
The approach we took was to download the dataset definition as an ascii file.

We then parsed it (as text) into a dictionary. From that we created classes to hold the data from the file but an XML schema would do - this is the tricky part or the easy part depending on your specific requirements (and not something I can expand on properly in this forum).

Using the techniques from this CP article - EBCDIC to ASCII Converter[^] we then converted the file into ASCII (and thence to XML)


Cobol可以创建不同类型的文件 - 修复长度或可变长度或所谓的VSAM文件。

文件中的字段可以定义为字符(C#中的字符串)或数字。

数字可以是不同的类型 - 有符号或无符号,COMP-3(无符号签名),COMP(签名或未签名)和其他一些不经常使用的类型。

在大型机上的文件可以创建为AS CII或EBCDIC。

如果你的文件只有文本字段,它看起来很简单。

让我们在cobol中假设你有:

Cobol can create different types of files - fix length or variable length or so called VSAM files.
Fields in the file can be defined as Characters (string in C#) or numeric.
Numeric can be different types - signed or unsigned, COMP-3 (signed of unsigned), COMP (signed or unsigned) and some other not often use types.
On the Mainframe files can be created as ASCII or EBCDIC.
If you file has only text field it look pretty simple.
Lets assume in cobol you have:
01 record.
       03 first-name   pic x(20).
       03 last-name    pic x(30).
       03  address     pic x(10).




$ C $ b in C#:



in C#:

using (StreamReader sr = new StreamReader(filePaths, System.Text.Encoding.ASCII))
{
   String w_line;
   // Read and display lines from the file until the end of
   // the file is reached.
   while ((w_line = sr.ReadLine())!= null)
   {
      string firstName = w_line.Substring(0,20) ;
      string lasttName = w_line.Substring(20,30) ;
      string address = w_line.Substring(50,10) ;







zb




zb


这是我目前正在处理的解决方案。

此文件以制表符分隔。其他人不是。这些文件解决方案2是理想的。

输入文件包含每个贷款号码15条记录,总共477个字段。

目标是读取制表符分隔文件,拆分记录/字段,格式化带有标题的输出文件,将文件加载到LRS ANYQ中作为文本文件报告进行打印并加载到图像系统中进行查看。



流程(行);

cline = builder;

bRec = cline.Substring(0,1);

if(bRec 。包含A))//记录类型A

{

string oline =;

string [] RAFields = cline。 Split(new char [] {'\ t'});

string RAF1 = RAFields [1];

string RAF2 = RAFields [2];

string RAF3 = RAFields [3];

oline =

String.Format({0},RAF1 +'\ n')/ /服务号码

+ String.Format({0},RAF2 +'\ n')//服务商名称

+ String.Format({0},RAF3 +'\ n' )// Servicer Addr Line 1

builder = oline;

string path2 = @c:\400\400717to.txt;

string alltext = builder + Environment.NewLine;

File.AppendAllText(path2,(alltext));
This is the solution I am currently working on.
This file is tab delimited. Others are not. These files Solution 2 is ideal.
The input file contains 15 records per loan number with a total of 477 fields.
The goal is to read the tab delimited file, split the records/fields, format the output file with headings, load the file into LRS ANYQ as a 'text file report' to be printed and loaded into an image system for viewing.

Process(line);
cline = builder;
bRec = cline.Substring(0, 1);
if (bRec.Contains"A")) //Rec Type A
{
string oline = "";
string [] RAFields = cline.Split(new char[] {'\t'});
string RAF1 = RAFields[1];
string RAF2 = RAFields[2];
string RAF3 = RAFields[3];
oline =
String.Format("{0}", RAF1 + '\n') //Service Number
+ String.Format("{0}", RAF2 + '\n') //Servicer Name
+ String.Format("{0}", RAF3+ '\n') //Servicer Addr Line 1
builder = oline;
string path2 = @"c:\400\400717to.txt";
string alltext = builder + Environment.NewLine;
File.AppendAllText(path2, (alltext));


这篇关于我如何...在c#或其他可视化工作室语言中使用cobol数据集定义文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆