One effectively sets all the existing subfile records to blanks and zeros, the other removes existing records
SFLINZ (Subfile Initialize) keyword for display files
Use this record-level keyword on the subfile control record format to specify that the OS/400 program is to initialize all records in the subfile on an output operation to the subfile control record format (identified by the SFLCTL keyword). The fields in each subfile record are initialized to blanks for character type fields, to nulls for floating-point type fields, to zeros for other numeric type fields, or to the constant value specified on input-only fields if the DFT keyword is specified.
When the subfile is displayed (on an output operation to the subfile control record), all records in the subfile are displayed with the same value. Any record previously written is overwritten and no longer has its earlier value
SFLCLR (Subfile Clear) keyword for display files
Use this record-level keyword on the subfile control record format so that your program can clear the subfile of all records. This keyword differs from the SFLDLT keyword in that the subfile is not deleted. It differs from the SFLINZ keyword in that after being cleared, the subfile contains no data. Clearing the subfile does not affect the display. However, after being cleared, the subfile contains no active records.
This keyword has no parameters.
When active records already exist in the subfile and all are to be replaced, your program can send an output operation to the subfile control record format after selecting SFLCLR. This clears the subfile and permits your program to write new records to the subfile (by issuing output operations to the subfile record format while incrementing the relative record number). Issuing an output operation to an already active subfile record causes an error message to be returned to your program.
If SFLCLR is in effect on an output operation and no records exist in the subfile, SFLCLR is ignored
Showing posts with label subfiles. Show all posts
Showing posts with label subfiles. Show all posts
Monday, September 21, 2009
Thursday, December 09, 2004
Formatting and sorting dates in Displaytag
I use Displaytag for displaying data in an as400 Work-With Subfile type format in web pages, and it works very well.
One problem I came across was formatting the dates, whilst still using the automatic sorting. I thought I would have to format my data in my POJO and lose the automatic sorting.
But in fact Displaytag solves this problem by allowing you to apply decorators to columns
eg:
package com.decorator;
import java.util.Date;
import org.apache.commons.lang.time.FastDateFormat;
import org.displaytag.decorator.ColumnDecorator;
/**
* Simple column decorator which formats a date.
* @author epesh
* @author Fabrizio Giustina
* @version $Revision: 1.11 $ ($Author: fgiust $)
*/
public class DatetoDMY implements ColumnDecorator
{
/**
* FastDateFormat used to format the date object.
*/
private FastDateFormat dateFormat = FastDateFormat.getInstance("dd.MM.yyyy HH:mm:ss"); //$NON-NLS-1$
/**
* transform the given object into a String representation. The object is supposed to be a date.
* @param columnValue Object
* @return String
*/
public final String decorate(Object columnValue)
{
Date date = (Date) columnValue;
return this.dateFormat.format(date);
}
}
One problem I came across was formatting the dates, whilst still using the automatic sorting. I thought I would have to format my data in my POJO and lose the automatic sorting.
But in fact Displaytag solves this problem by allowing you to apply decorators to columns
eg:
package com.decorator;
import java.util.Date;
import org.apache.commons.lang.time.FastDateFormat;
import org.displaytag.decorator.ColumnDecorator;
/**
* Simple column decorator which formats a date.
* @author epesh
* @author Fabrizio Giustina
* @version $Revision: 1.11 $ ($Author: fgiust $)
*/
public class DatetoDMY implements ColumnDecorator
{
/**
* FastDateFormat used to format the date object.
*/
private FastDateFormat dateFormat = FastDateFormat.getInstance("dd.MM.yyyy HH:mm:ss"); //$NON-NLS-1$
/**
* transform the given object into a String representation. The object is supposed to be a date.
* @param columnValue Object
* @return String
*/
public final String decorate(Object columnValue)
{
Date date = (Date) columnValue;
return this.dateFormat.format(date);
}
}
Subscribe to:
Posts (Atom)
Popular Posts
- Configuring Tomcat5 and Apache2 with Virtual Hosts using mod_jk
- EclipseZone - Clean Up Warnings with the 'restriction' Suppression Flag
- Using as400 QRCVDTAQ api to retrieve a message / entry from a dataqueue
- AS400 Job Scheduler
- Common Gateway Interface (CGI) on the as400 / iSeries
- Adobe Flex 2.0 Beta
- AS400 APIs
- as400 Iseries Tips
- Raj Blogs: Common UNIX Commands
- Creating an as400 Query