Subfiles in As/400 For Programmers
Subfiles in As/400 For Programmers
ISeriesAs400Bloggertime:Subfile
0
More NextBlog
CreateBlog SignIn
ISeriesAs400Bloggertime
ShowingpostswithlabelSubfile. Showallposts
SATURDAY,1JUNE2013
BLOGARCHIVE
LABELS
2013(64)
AS400 (14)
June(18)
DDS(Data
Descriptio
n
Specificati
ons.)
SubfileTypes
pagedownhasbeencontrolbysystem.Inthismethodsubfilesizeisgreaterthan
subfilepage.
ii. Loadondemand[SIZ>PAG]bythismethodwecanloadonly9999records.Here
thepageupcontrolcanbecontrolledbysystemandusercontrolsthepagedown.In
thismethodsubfilesizeisgreaterthansubfilepage.
1. iii.Loadondemand[SIZ=PAG]bythemethodwecanloadunlimitedrecords.
2. HereusercontrolsbothofthePageupandPagedown.Inthismethodsubfilesizeis
3. equaltosubfilepage.Thistypeismoreadvantage
Postedbysivarazzmat08:21
Nocomments:
Labels:Subfile
Subfilekeywords
DB2
Keywords
RPGIII,IV
OPCODE
REFERAN
CES
As400 Interview
Questions (5) CL
Programs
(8)
RPGLE
Programs
(17) Sub file
(9)
Sub Procedures
(3)
DB2/400
Keywords
As/400
Numbers
As400
Questions
and
answers
byusers
AS/400
System
O.S
(Operating
System/40
0)
DDS(Data
Descriptio
n
Specificati
ons.)
DataAreas
CL/400
Interview
Questions
Data
Structure
SFLENTERThisrecordlevelkeywordusedtoassignasarollupkey.Youcandefineanotherkeyfor
enterpurpose.
Exception/Err
or
Handling
SFLINZThisrecordlevelkeywordisusedtoinitializetheSubfile.
Arrays
concepts
SFLLINThisrecord level keyword is used to define how many spaces are to be inserted between
Subfilerecords.
SFLMSGThisrecordlevelkeyword,whichidentifiesthesubfile,isaMessageSubfile.
SFLMSGIDThisrecordlevelkeywordisusedaslikeasSFLMSG.Hereyoujustputthe
messageIDinsteadofhardcodingthemessagetext.
SFLMSGKEYThisrecordlevelkeywordisusedtospecifythefieldusedasmessagekey.
OpenQuery
File
Subfile
Types
Hist
Subfile
keywords
Checkyour
subfile
skills
May(46)
SFLMSGRCDThisrecordlevelkeywordisusedtospecifywhatline#,wherethemessagehastobe
displayed.
SFLPGMQThiskeywordspecifiestheprogrammessagequeuethatconfirmstheSubfilerecordsfor
http://as400error.blogspot.in/search/label/Sub%20file
1/8
3/26/2015
ISeriesAs400Bloggertime:Subfile
amessageSubfile.
SFLNXTCHGThisrecordlevelkeywordisusedtomarktheSubfilerecordsasbeingchanged.
SFLPAG This record level keyword is used to determine how many Subfile records to show per
displayscreen.
SFLROLVALThisrecordlevelkeywordidentifiestheno.recordstoroll,wheneverarollup/rolldown
keyispressed.
SFLSIZThisrecordlevelkeywordisusedtosettheinitialsizeofSubfile
SFLDROP This record level keyword. The program first displays the Subfile in truncated mode
[displayinonelineform].Whentheuserpressestheassociatedkey,itwilldisplayfoldedform.
SFLFOLDThisrecordlevelkeyword.TheprogramfirstdisplaystheSubfileinfoldedmode[displayin
multiplelineform].Whentheuserpressestheassociatedkey,itwilldisplaytruncatedform.
SFLMODEThisrecordlevelkeywordisusedtotellwhethertheSubfileisindropmodeorfoldmode.
Ifthemode=1meansDropmodeandthemodeis0meansFoldmode.
SFLENDControlsthedisplayofplussign.
SFLRCDNBRControlswhatSubfilepageisdisplayedandwherecursorgoes.
SFLRNARecordnotactiveusedtomakethefileinactive.
Postedbysivarazzmat08:19
Nocomments:
Labels:Subfile
Checkyoursubfileskills
5.WhatarethemandatorykeywordsfordeclareSubfile.
SFL,SFLCTL,SFLDSP,SFLSIZandSFLPAG
SFL
ItdefinestherecordisSubfilerecord.
SFLCTL
Itdefinestherecordisacontrolrecord.
SFLDSP
Itistodisplaythedataisthedisplayscreen.
SFLSIZ
ItidentifiestheSubfilesize.ThemaxsizeforLoadallis9999.
SFLPAG
Itidentifiestheno.ofrecordtobedisplayedatatime.ForloadallitshouldbelessthanSFLSIZ
6.WhatisRelativeRecordNumber[RRN]?
RelativeRecordNumber[RRN]isauniquenumeralvalueusedtopositionrecordsinSubfile.
http://as400error.blogspot.in/search/label/Sub%20file
2/8
3/26/2015
ISeriesAs400Bloggertime:Subfile
7.WhatDDSkeywordsarerequiredwhendefiningacontrolrecordformat?
SFLCTL,SFLDSPCTL,SFLPAG,SFLSIZ.
8.Whatarethe3typesofsubfiles?
Singlepage,expandableandloadall.
9.WhichtypeofSubfilehasthebetterperformance?
Singlepage.
10.WhatisaSubfilerecordnumber?
TheinternalvalueassociatedwiththeeachSubfilerecord.
11.WhatdoesO.S400controllingofSubfilemean?
In Load All Subfile if we press the Page Up or Page Down key the controlwill not go to the
programandtheO.S.400willtakethecontrolandredisplaytheprecedingorsucceedingrecords.
ThissimplifiesthecodingandifthebeginningorendofSubfilereachedthentheO.S400will
automaticallydisplaythemessagelikeEndOfFileReached.
12.WhywouldonetakecontroloverrollingofSubfilerecord?
Itwillreducethetimetakentoredisplaytherecordsifthereislargerecords.Ifwedefinetheroll key
thenthecontrolwillreturntoprogramwhiletherollkeyispressed.Theprogramthenaddsnewrecords
anddisplay.
13.HowwillyougetaPlussigninSubfile?
ByspecifyingtheSFLENDkeyword.Ifwespecify*MorewithSFLENDthenthewordMORE
willbeatlowerrightcornerwhichindicatesmorerecordsarethereinSubfilethandisplayingandifend
offilereachedthenitwilldisplayBOTTOM.
14.HowdoesCLRLwork?CompareitwithOVERLAY.
ThiskeywordisusedtoClearandControlspecificnumberoflinesfromthescreen.Italsohelps
to overlap two record formats without the first format is being cleared completely. Only those lines
clearedfromthefirstformataredeleted,allotherlineswillremaininthescreen.
If we specify CLRL (*NO) for a format then no line will be cleared. So if a record format is
overlayedthenthelinesofthepreviousformatwillnotbedeletedbutjustoverlayed.
It is not in case of OVERLAY. If any line in the first format in the overlaps then the complete
formatwillbedeletedbeforenextformatdisplay.
15.WhatdoyoumeanbySFLRCDNBR?
ItmeansSubfilerecordnumber.Thisisusedinloadalltype.
SupposewearelivinginthirdpageandifwepressEnterkey,thenthecontrolwill go to first
page.Soifwemovethepositionof378to379oftheFileInformationDataStructuretoahiddenfield
thentheRRNvalueandSubfileRecordNumberwillbesame.Sothecontrolwillbeinthelivingpage.
WecannotuseSFLRCDNBRandSFLROLVALsimultaneously.
16.WhatdoestheSFLNXTCHGkeywordmean?
ItmeansSubfileNextChange.ItactivatestheREADCoperationandmarkrecordsaschanged
records.
Suppose the READC operation reads fifth or sixth changed record and if modify a second or
firstrecordthenREADCwontreadthatrecord.ForthisweactivatetheSFLNXTCHGkeywordwithan
indicator.SoifwechangearecordthatindicatorwillsetonandREADCwillreadallchangedrecord.
Postedbysivarazzmat08:15
Nocomments:
Labels:Subfile
FRIDAY,31MAY2013
MESSAGESubfiles
MESSAGESubfiles
Createthemessagefileandtheerrormessages.Issuethefollowingcommands:
MESSAGESUBFILE:
http://as400error.blogspot.in/search/label/Sub%20file
3/8
3/26/2015
ISeriesAs400Bloggertime:Subfile
CRTMSGFMSGF(MYLIB/TSTMSGF)
ADDMSGDMSGID(ERR0001)MSGF(MYLIB/TSTMSGF)MSG('Exampleoferrormessage')
DISPLAYFILE:
MessageSubfile:
ARMSGSFLSFL
ASFLMSGRCD(24)
AM@MSGKSFLMSGKEY
AM@PGMQSFLPGMQ(10)
MessageSubfileControl:
ARMSGCTLSFLCTL(MSGSFL)
A41SFLDSP
A43SFLDSPCTL
A40SFLCLR
A42SFLEND
ASFLSIZ(0010)
ASFLPAG(0001)
RPGPROGRAM:
InitializeMessageSubfileinExtendedFSpecificationasbelow
FSFILE(MSGSFL:W$RRN1)
SubroutineClearMessageSubfile
C#CLRMGBegSr
*
CSetOn40
CSetOff414243
CWriteMsgCtl
CSetOff4041
CSetOn4243
CZAdd*ZEROW$RRN1
*
CEndSr
ClearSubroutine:
SetoffSFLDSP,SFLDSPCTL
SetonSFLCLR
SetoffSFLEND
ClearMSGCTL
SetoffSFLDSP,SFLCLR
SetonSFLDSPCTL,SFLEND
SubroutineWriteMessageSubfile
C#SDMSGBegSr
*
CSetOn41
CCall'SSM720C1'
CParmP$MGID7
CParm'CCCMSGF'P$MSGF10
CParmP$MGVL80
CParmP$MSGK4
CParmP$CSTS1
*
CEvalM@MSGK=P$MSGK
CAdd1W$RRN1
CWriteMsgSfl
http://as400error.blogspot.in/search/label/Sub%20file
4/8
3/26/2015
ISeriesAs400Bloggertime:Subfile
*
CEvalP$MGVL=*BLANK
*
CEndSr
CLPROGRAM:
PGMPARM(&MSGID&MSGF&MSGVAL&MSGKEY&CMPSTS)
DCLVAR(&MSGID)TYPE(*CHAR)LEN(7)
DCLVAR(&MSGF)TYPE(*CHAR)LEN(10)
DCLVAR(&MSGVAL)TYPE(*CHAR)LEN(80)
DCLVAR(&MSGKEY)TYPE(*CHAR)LEN(4)
DCLVAR(&CMPSTS)TYPE(*CHAR)LEN(1)
CHGVARVAR(&CMPSTS)VALUE('0')
SNDPGMMSGMSGID(&MSGID)MSGF(*LIBL/&MSGF)+
MSGDTA(&MSGVAL)KEYVAR(&MSGKEY)
MONMSGMSGID(CPF0000)EXEC(CHGVARVAR(&CMPSTS)+
VALUE('1'))
EXIT:ENDPGM
UsingRRNtoChaintoSubfiles
WecanuseRRNtochaintosubfiletoreadallrecords(thismightbeparticularlyusefulinEDITABLE
subfilessincewemayhavetoreadallrecords)
Rrn=1
DoWhileRrn<=SubfileRrn
RrnChainSubfile
(.xxx.)
UpdateSubfile
Rrn=Rrn+1
EndDo
(Updatethesubfileifyouwanterrorstobehighlighted)
AllrecordscanalsobereadfromasubfilebymakingSFLNXTCHG=ONandthendoingaREADC.
Postedbysivarazzmat22:26
Nocomments:
Labels:Subfile
THURSDAY,30MAY2013
CheckingRecordLocksWhileUpdatingPFinSubfiles
CheckingRecordLocksWhileUpdatingPFinSubfiles
RPGLE
Checkfor%STATUSafterdoingaCHAIN(E)tofile.
If%STATUS=01218,thenrecordislocked.
RPG
Checkforstatuscode01218inthefileinformationdatastructure(INFDS).
http://as400error.blogspot.in/search/label/Sub%20file
5/8
3/26/2015
ISeriesAs400Bloggertime:Subfile
DeclareINFDStoFspecificationinKeywordscolumnINFDSFILEDS
Now,declareFILEDSasbelow
IFIELDSDS
I*STATUSSTAT
Now,inprogram,afterCHAIN,checkforSTAT=01218
Postedbysivarazzmat10:49
Nocomments:
Labels:Subfile
MESSAGESubfiles
MESSAGESubfiles
Createthemessagefileandtheerrormessages.Issuethefollowingcommands:
MESSAGESUBFILE:
CRTMSGFMSGF(MYLIB/TSTMSGF)
ADDMSGDMSGID(ERR0001)MSGF(MYLIB/TSTMSGF)MSG('Exampleoferrormessage')
DISPLAYFILE:
MessageSubfile:
ARMSGSFLSFL
ASFLMSGRCD(24)
AM@MSGKSFLMSGKEY
AM@PGMQSFLPGMQ(10)
MessageSubfileControl:
ARMSGCTLSFLCTL(MSGSFL)
A41SFLDSP
A43SFLDSPCTL
A40SFLCLR
A42SFLEND
ASFLSIZ(0010)
ASFLPAG(0001)
RPGPROGRAM:
InitializeMessageSubfileinExtendedFSpecificationasbelow
FSFILE(MSGSFL:W$RRN1)
SubroutineClearMessageSubfile
C#CLRMGBegSr
*
CSetOn40
CSetOff414243
CWriteMsgCtl
CSetOff4041
CSetOn4243
http://as400error.blogspot.in/search/label/Sub%20file
6/8
3/26/2015
ISeriesAs400Bloggertime:Subfile
CZAdd*ZEROW$RRN1
*
CEndSr
ClearSubroutine:
SetoffSFLDSP,SFLDSPCTL
SetonSFLCLR
SetoffSFLEND
ClearMSGCTL
SetoffSFLDSP,SFLCLR
SetonSFLDSPCTL,SFLEND
SubroutineWriteMessageSubfile
C#SDMSGBegSr
*
CSetOn41
CCall'SSM720C1'
CParmP$MGID7
CParm'CCCMSGF'P$MSGF10
CParmP$MGVL80
CParmP$MSGK4
CParmP$CSTS1
*
CEvalM@MSGK=P$MSGK
CAdd1W$RRN1
CWriteMsgSfl
*
CEvalP$MGVL=*BLANK
*
CEndSr
CLPROGRAM:
PGMPARM(&MSGID&MSGF&MSGVAL&MSGKEY&CMPSTS)
DCLVAR(&MSGID)TYPE(*CHAR)LEN(7)
DCLVAR(&MSGF)TYPE(*CHAR)LEN(10)
DCLVAR(&MSGVAL)TYPE(*CHAR)LEN(80)
DCLVAR(&MSGKEY)TYPE(*CHAR)LEN(4)
DCLVAR(&CMPSTS)TYPE(*CHAR)LEN(1)
CHGVARVAR(&CMPSTS)VALUE('0')
SNDPGMMSGMSGID(&MSGID)MSGF(*LIBL/&MSGF)+
MSGDTA(&MSGVAL)KEYVAR(&MSGKEY)
MONMSGMSGID(CPF0000)EXEC(CHGVARVAR(&CMPSTS)+
VALUE('1'))
EXIT:ENDPGM
UsingRRNtoChaintoSubfiles
WecanuseRRNtochaintosubfiletoreadallrecords(thismightbeparticularly
usefulinEDITABLEsubfilessincewemayhavetoreadallrecords)
Rrn=1
DoWhileRrn<=SubfileRrn
RrnChainSubfile
(.xxx.)
UpdateSubfile
Rrn=Rrn+1
EndDo
(Updatethesubfileifyouwanterrorstobehighlighted)
AllrecordscanalsobereadfromasubfilebymakingSFLNXTCHG=ONandthendoinga
READC.
http://as400error.blogspot.in/search/label/Sub%20file
7/8
3/26/2015
ISeriesAs400Bloggertime:Subfile
Postedbysivarazzmat10:47
Nocomments:
Labels:Subfile
Home
OlderPosts
Subscribeto:Posts(Atom)
PictureWindowtemplate.PoweredbyBlogger.
http://as400error.blogspot.in/search/label/Sub%20file
8/8