|
Hi Tom, This would be a fun one to work with. However, since I am a beginner (MI) too, probably the experts will have fixed the program before I even look at it! Rich Hart (rhart@atcdgis.com) -----Original Message----- From: Tom Daly [mailto:tdaly_2002@yahoo.com] Sent: Friday, October 04, 2002 3:42 PM To: mi400@midrange.com Subject: [MI400] Beginner question re: CPYBTL <PRE> Hi, I need to expand a 3 character string to 4 characters a-la base64 encoding. C is not available right now - but MI is. So armed with Leif's excellent book and an MI manual I discovered the CPYBTL operation which appears to be just the ticket. But it seems no matter what I try I can not get the expected results. Expected results: 24 22 9 35 Actual results (repeatedly no matter what gyrations I try): 00 22 00 00 So what am I missing about CPYBTL? Here's the code: /* 12345678123456781234567812345678 */ DCL DD SOURCE CHAR(4) INIT(X'01100001011000100110001100000000'); /* 97 98 99 0 */ DCL DD RECEIVER1 BIN(4) UNSGND; DCL DD RECEIVER2 BIN(4) UNSGND; DCL DD RECEIVER3 BIN(4) UNSGND; DCL DD RECEIVER4 BIN(4) UNSGND; DCL DD RECEIVER CHAR(1); /* Do the deed */ CPYBTL RECEIVER1, SOURCE, 1, 6; CPYBTL RECEIVER2, SOURCE, 7, 6; CPYBTL RECEIVER3, SOURCE, 13, 6; CPYBTL RECEIVER4, SOURCE, 19, 6; /* make the results displayable */ CPYBRA RECEIVER, RECEIVER1; CVTHC MSG-TEXT( 1:2), RECEIVER; CPYBRA RECEIVER, RECEIVER2; CVTHC MSG-TEXT( 4:2), RECEIVER; CPYBRA RECEIVER, RECEIVER3; CVTHC MSG-TEXT( 7:2), RECEIVER; CPYBRA RECEIVER, RECEIVER4; CVTHC MSG-TEXT(10:2), RECEIVER; /* display the results */ CALLI SHOW-MESSAGE, *, .SHOW-MESSAGE; RTX *; %INCLUDE SHOWMSG =-=-=-=-=-=- Thanks guys! Tom Daly </PRE> __________________________________________________ Do you Yahoo!? New DSL Internet Access from SBC & Yahoo! http://sbc.yahoo.com _______________________________________________ This is the MI Programming on the AS400 / iSeries (MI400) mailing list To post a message email: MI400@midrange.com To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/cgi-bin/listinfo/mi400 or email: MI400-request@midrange.com Before posting, please take a moment to review the archives at http://archive.midrange.com/mi400.
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.