× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: changing two fields in a file
  • From: "James W. Kilgore" <qappdsn@xxxxxxx>
  • Date: Fri, 20 Aug 1999 02:22:41 -0700
  • Organization: Progressive Data Systems, Inc.

The numeric length change isn't a problem with CPYF *MAP, it's the alpha to
numeric that has the potential to give you some problems.  It also means you
can't use CHGPF or CPYF.  And you're close, a 16 line program just might do it.

IMO, you would have to check the integrity of the alpha field first.  A simple
program where the file is program defined and you test the contents of the alpha
field to be 0->9 and maybe update blank to zero or whatever default you want 
(are
negatives allowed? N=neg 5).

If you compile the conversion program in RPGII and define the alpha input as
numeric, it will trust you (God like) and default to convert blanks to zeros and
you can z-add your 1 byte to 4 byte field.  The remaining 108 fields can be
lumped together,

If the test shows no -real- problems, how's this: (spacing not correct)

    Finput   IP  f        xxxx        disk
    Foutput  O   f        xxxx        disk
    Iinput    ns    01
    I                            1     xx part01
    I                            xx    xx0one24a
    I                            xx    xx part02
    I                            xx    xx0one24N
    I                            xx    xx part03
    C            Z-addone24a    out4a    40
    C            z-addone24N    out4n    40
    Ooutput    d    01
    O                part01    xx
    O                out4a     xx
    O                part02    xx
    O                out4n     xx
    O                part03    xx


> > > I am thinking this is easy but I have been able to really complicate it.
> > >
> > > I have a file where the record has 110 fields in it.   Two of
> > those fields
> > > are to be changed, one from 1 alpha to 4 numeric, the other
> > from 1 numeric
> > > to 4 numeric.
> > >
> > > This seems to me to be a 15 line program but it isn't turning out that
> > > way.  Any ideas of a good fast algorithym to do it?
> >
> >

+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.