×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Rob! your solution is perfect for this kind of issue.



Warm Regards,
JoeP





From: rob@xxxxxxxxx
Reply-To: RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
To: RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
Subject: Re: change data type
Date: Thu, 24 Aug 2006 16:23:20 -0400

Don't think you can take a character field with a packed number and do a
testn on it.  For example, one sample 2 character field representing a
valid packed number would be
char2=x'001F'; // Note:  the x'...' means hex
I don't think testn would fly against that.
While this may test fine
char5='0123J';  // Certain letters in the last position may indicate a
"sign" (plus, minus) over a number.
This may test fine with TESTN but be totally meaningless in your
application.
You could try reading the flat record into a datastructure.  Then with
judicious use of MONITOR and ON-ERROR test each field
D recds
D   name                  20a
D   wage                    5p 2
...
read file ....; // use the option to read into a data structure.
monitor;
wage=wage+0;
On-error;
  // wage ain't right
End-mon;

Rob Berendt
--
Group Dekko Services, LLC
Dept 01.073
PO Box 2000
Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com





murali dhar <hydchap1@xxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
08/24/2006 03:42 PM
Please respond to
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>


To
RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx>
cc

Subject
change data type






Hi All,
  I have a  flat file with packed data occupied  in different positions of
each record.I want  to identify the packed fields and convert them to
zoned and create a new record with the unpacked data. Iam not worried if
file length gets changed.
  Iam looking at some of the op codes  like TESTN/TESTB etc
  Request you to propose some suggestions to handle this requirement.

  Thanks a lot

  Murali.


---------------------------------
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+
countries) for 2¢/min or less.
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.


--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.


_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/


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-2026 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.