|
Patrick, The below program can serve your requirement. ================================================================= 1. D dtads ds 2. Dsubfld 6s 0 3. C *dtaara define PROCYR 6 0 4. C *lock in procyr 5. C move procyr dtads 6. * create a character representation of the data area 7. C movel subfld charfld 6 8. C charfld dsply 9. C move dtads procyr 10. C out procyr 11. C eval *inlr = *on 12. C return ================================================================= I do not know, why you are moving to data structure with one sub field. If you want to use with single field numeric data area to a character field in your program you need NOT to have DS at all. In this case please remove the inline code above by line 1,2 and 7. Change line 5 as 5. C movel procyr charfld 6 Change line 9 as 9. C move charfld procyr that 's it. If you want to access data area data structure, it is allowed only on *LDA type. UDS data structure is explicitly based on the *LDA using the DTAARA keyword. Since it is a data area data structure, it is read in during initialization and written out during termination. It can also be handled using IN and OUT operations, since the DTAARA keyword was used. Generally, UDS is used as D uds Dsubfld 1 600A If you want to use DTAARA keyword, you may need not give data structure name also. D LDADS UDS DTAARA(*LDA) Dsubfld 1 600A ........ C IN LDADS ........ C OUT LDADS Please remember, the *LDA is always *CHAR type. Regards, Ramana -----Original Message----- From: Shrader, Patrick [mailto:pshrader@xxxxxxxx] Sent: Thursday, May 29, 2003 4:53 AM To: RPG Mailing List Subject: data area question Folks, I need some guidance. I very rarely use data areas to transfer information, but in this case I must capture some data that is stored there. Whenever I run this program I get an error message telling me that my data area type or length does not match my program data area. Any tips would be appreciated. Thanks in advance, Patrick Code (V4R5): D period uds dtaara(PROCYR) D cmonth 6s 0 D month s 6 * create a character representation of the data area C move cmonth month * C eval *inlr = *on C return Data area definition: Display Data Area System: Data area . . . . . . . : PROCYR Library . . . . . . . : FILLIB Type . . . . . . . . . : *DEC Length . . . . . . . . : 6 0 Text . . . . . . . . . : Processing Year and Month Value . . . . . . . . . : 200312 Error message: Additional Message Information Message ID . . . . . . : RNX0411 Severity . . . . . . . : 50 Message type . . . . . : Escape Date sent . . . . . . : 05/28/03 Time sent . . . . . . : 19:13:49 Message . . . . : Data area PROCYR type or length does not match program data area. Cause . . . . . : Data area PROCYR was defined in the RPG procedure to be of type *CHAR and length 6. The actual data area XYZLIB/PROCYR is of type *DEC and length (6 0). If a *LGL data area is expected, a data area of type *CHAR and length 1 is also allowed. Recovery . . . : Correct the type or length of the data area, or change the library list so the correct data area will be found. _______________________________________________ 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.
As an Amazon Associate we earn from qualifying purchases.
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.