|
Please take a look at DDS Keyword CSRLOC and RTNCSRLOC. CSRLOC is used to put the cursor at the specified position, also outside an input field. RTNCSRLOC return the format name and the field name where the cursor was when the function key or the enter key was pressed. In order to retrieve the function key the user pressed specify the control-area in the select statement of your display file. Finally, using the ACCEPT yourvar FROM FEEDBACK you'll be able to retrieve the cursor position. See your COBOL / DDS Reference. Roy Restuccia -----Messaggio originale----- Da: cobol400-l-bounces@xxxxxxxxxxxx [mailto:cobol400-l-bounces@xxxxxxxxxxxx] Per conto di Jim Essinger Inviato: venerdì 9 luglio 2004 21.34 A: COBOL Programming on the iSeries/AS400 Oggetto: RE: [COBOL400-L] Working with SDA screens Indicators are simple on/off switches for program control of display, and printer files. There are only 01 through 99 that you can use. 00 is invalid, as is anything over 99. Your assumption is correct. Once you have set the indicator on (70 in the example) and written the display record, the display will respond to what the indicator is set for. In the example I posted, change the color of the field, and position the cursor to the field that needs attention. Each field on the display needs it's own indicator. If you have 5 fields you might want to place the cursor in when you write the display file, you need 5 different indicators. If all 5 indicators are on when you write the record, the field closest to the upper left corner of the display will be where the cursor will be placed. I have 99 indicators defined because that is the max that is allowed. I then have a scheme that sets aside the first 24 for the F01 through F24 keys. I then use a set number to do screen functions, like position cursor, or protect a field, or change the color of a field. Indicators are used in a lot of places within printer and display files. When you get into subfiles (lists of car parts, for example), you need to clear the subfile before you fill it, and you set on an indicator to do that before writing out the control record for the subfile. Sometimes to position a cursor to a record in a subfile you will set on an indicator before you write the subfile record. Indicators are strange to us COBOL programmers, but they are/were used a lot in RPG, and were carried over from there to COBOL for the System 36/38 and the AS/400 - iSeries. There are other ways in COBOL to tell if someone has pressed a command key, so you may not need to use indicators there, if you don't want. There is a data area that I have not used much that has this type of information. But to control the display and printer files, they are the only option we have. At 12:59 PM 7/9/2004, you wrote: Thanks Jim you have a lot of code that haven't try although you have a lot of comments I don't think it would be any trouble. Let me ask you something to see if I understand correctly, in your definition you define an array of indicators 99 occurrences (why 99? Just to illustrate?), and I'm figuring in each field you define you are assigning them a number, like in the example you have 70 on the date field, is that correct? If this is correct all I have to do is turn on the indicator on the field that a need attention, right? Thanks again !! -----Original Message----- From: Jim Essinger [mailto:esinger@xxxxxxxx] Sent: Friday, July 09, 2004 11:40 AM To: COBOL Programming on the iSeries/AS400 Subject: RE: [COBOL400-L] Working with SDA screens Best viewed with a fixed pitch font. To code my display files, I use Code designer, but for the examples, I have shown the DDS that is created. SDA can also be used to code the screen files, but there might be some things like date data types that are not supported by SDA. DDS for the display file, File level keywords I use: A DSPSIZ(24 80 *DS3) A REF(LibName/FileName FmtName) <---- Used with a field reference file A PRINT A INDARA A CF03(03 'End of program') The INDARA keyword sets the display file to use a separate indicator area for the entire file. CF03 will turn on indicator 03 in the array of indicators if that key gets pressed. By coding the Print and CF03 function keys at file level, they are always available. They can be coded on a screen by screen basis. DDS for a date field: A DBSTARTDTER 8Y 0B 15 17REFFLD(FmtName/FieldName + A LibName/FileName) A N70 COLOR(TRQ) A 70 COLOR(RED) A EDTWRD(' / / ') A EDTMSK(' & & ') A CHECK(FE) A 70 DSPATR(PC) In the above code, if indicator 70 is on, the color will be red, and the cursor will be positioned to the field {DSPATR(PC)}. If Indicator 70 is off, the color will be turquoise, and the cursor will most likely be someplace else. COBOL Program: INPUT-OUTPUT SECTION. FILE-CONTROL. * ---------------------------------------------------------------- * This is the Display file * Note: the SI after the file name tells COBOL that * this files uses a Separate Indicator area * ---------------------------------------------------------------- SELECT Display-File Assign to workstation-FileName-SI Organization is TRANSACTION Access is Dynamic Relative Key is Ws-Rrn File status is Display-Status. DATA DIVISION. FILE SECTION. * ---------------------------------------------------------------- FD Display-File * ---------------------------------------------------------------- * Generic space reserved for the display file records * ---------------------------------------------------------------- 01 Display-Rec Pic X(1024). Working Storage. * Note: Indic-Array is used to control indicators on the display file. 01 ARRAYS-AND-TABLES. 05 Indic-Array occurs 99 times Pic 1 Indicator 1. 88 Ind-Off value B"0". 88 Ind-On value B"1". * Note: 1 copy per format in the display file. Gives me the feeling of control * The 'Prefix by' gives me unique field names if there are same names in the format * the DDR gives me the alias name if available (and I usually code alias names) and fixes underscore to dash, etc. 01 Display-Record. COPY DDR-SflCtl1-I IN FileName Prefix by "Ctl1-". COPY DDR-SflCtl1-O IN FileName Prefix by "Ctl1-". COPY DDR-SflSubF1-I IN FileName Prefix by "Sfl1-". COPY DDR-SflSubF1-O IN FileName Prefix by "Sfl1-". COPY DDR-Win02-I IN FileName Prefix by "Win2-". COPY DDR-Win02-O IN FileName Prefix by "Win2-". COPY DDR-Scn03-I IN FileName Prefix by "Scn3-". COPY DDR-Scn03-O IN FileName Prefix by "Scn3-". COPY DDR-Win04-I IN FileName Prefix by "Win4-". COPY DDR-Win04-O IN FileName Prefix by "Win4-". PROCEDURE DIVISION. * Check the date field. If it needs attention (error?) set on the indicator 70, then display the screen * Error checking Set Ind-on(70) to true. * Display the screen and get input Write Display-rec From Scn03-O format "SFLCTL1" indicators are indic-array Read Display-File Into Scn03-I format "SFLCTL1" indicators are indic-array * Check to see if F3 was pressed on the screen If Ind-On(03) * End the program some how. Writing from and reading into working storage areas gives me protection from one screen wiping out anothers screen worth of data. Hope this helps! Jim _______________________________________________ This is the COBOL Programming on the iSeries/AS400 (COBOL400-L) mailing list To post a message email: COBOL400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/cobol400-l or email: COBOL400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/cobol400-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.