[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] COBOL as Perl



>>>>> "JP" == John Porter <jdporter@min.net> writes:

JP> [mailed to you only]
>> I'd like to put on the table an idiom that I've been using for years.

JP> You have?  To do what?  I can't see what general-purpose application
JP> this "template" might have.  You really didn't give any clue what
JP> it's good for.

JP> And why do you call it a "template"?

(I'm feeling old. How many folks here have done either COBOL or big
blue programming? This was the first thing we learned to do,
Master/Transaction. Does anyone remember the McCraken book? Punch
Cards, TSO, TSO/ISPF, SVC99, The IBM System Services Manual with that
strange footnote.)

It is so ingrained that I couldn't imagine anyone not recognizing it.
This is the pseudo-code (or template) for doing a Master/Transaction
or file merge operation.

You use it for handling any two sorted files that have a common key.
This is the heart of two standard unix utilites: join and comm. Hmm,
has ppt done join or comm?

I'm using this as the main loop for a program that will consolidate
and merge two years of customer data before moving them to their final
resting place on an optical jukebox.

>> However, This looks and smells like COBOL. 

JP> Nothing wrong with that. 
JP> If only Perl supported a COBOLish paradigm better...

Which part of COBOL?

	FD	FOOO.
	01	FOO-RECORD.
	  05	ACCOUNT-KEY.
		10 ACCOUNT-NUMBER	PIC X(5).
		10 DUMMY		PIC X.
		10 ACCOUNT-VERSION	PIC 9(2).
	  05	ACCOUNT-SPEC REDEFINES ACCOUNT-KEY.
		10 ACCOUNT-CHART	PIC X(2).
		10 ACCOUNT-SUB-ACCT	PIC 9(4).
		10 DUMMY		PIC X.
		10 ACCOUNT-CHK-DGT	PIC 9.

I think of this in terms of pack/unpack and format.

I find format _much_ easier than describing the lines by pieces.

The only one that I still haven't figured out properly is how to
make a line optional.

<chaim>
-- 
Chaim Frenkel					     Nonlinear Knowledge, Inc.
chaimf@pobox.com				               +1-718-236-0183

==== Want to unsubscribe from Fun With Perl?
==== Well, if you insist... Send mail with body "unsubscribe" to
==== fwp-request@technofile.org