F3400GetForecastByType

F3400 Get Forecast By Type

Major Business Rule

Object Name: B3400650

Parent DLL: CMFG

Location: Client/Server

Language: C

1.Functional Description

1.1Purpose
This function will return the levels of the summary forecast hierarchy that match the input pieces of 
the key, for the given forecast types.


1.2Setup Notes and Prerequisites

• The calling application must close the F3400 and F3460 tables using business function 
C4102A1-FreeHuserAndHrequest when processing is complete.


1.3Special Logic


2.Technical Specifications

1.Create an array to hold the 54 Periods passed in and an array of 54 char flags PeriodCount
2.If GetMoreRecords is equal to blank


/*Load array @S with the key values*/


Create an 14 big array (@S) of 8 big fields
Move Company to @S,2

Move LevelOne- LevelTen into @S,3 - @S,12

Move Customer into @S,13

Move a ShortItem to @S,14


*/ Load the flags that indicate if a level is in the hierarchy into the array 

@L*/


Create a 14 big array (@L) of one character fields and initialize them all to 
zero

If Global Level is equal to '1'

Move a 1 to @L,1

End

If Company Level is equal to '1'

Move a 1 to @L,2

End


Move 03 to Y

Move Category1Level - Category10Level to a 10 big array (@C)

Do 10 times

If @C,Y is equal to '1'

Move a '1' to @L,Y 

End

Add 1 to Y

Enddo


If Customer Level is not blank

Move a 1 to @L,13

End

If ItemLevel is equal to '1'

Move a '1' to @L,14

End


If there are any blank key values in @S between the lowest non-blank level and 

the top level,

move a '*' to that key value in @S


*/Build the select statement based on what the above @L array says is in the hierarchy */


Select over the F3400 where

The Requested date is between the BeginDate and EndDate

The Forecast Type is equal to one of the Twelve Forecast Types passed in


*./ Select on Item field */


If @L,14 is not equal to zero

If @S,14 is not equal to zero

Select on Item = @S,14

Else

If AllItems is equal to '1'

Select on Item not equal to zero

Else

Select on Item equal to zero

End

End

Else

Select on Item equal to zero

End


*./ Select on Customer field */


If @L,13 is not equal to zero

If @S,13 is not equal to zero

Select on Customer = @S,13

Else

If AllCustomers is equal to '1'

Select on Customer not equal to zero

Else

Select on Customer equal to zero

End

End

Else

Select on Customer equal to zero

End



*/ Select on Category Code fields */


Move 12 to X
Move 10 to Y

Do 10 times

If @L,X is not equal to zero

If @S,X is not equal to blanks

If @S,X is equal to '*'

Select on Category Code Y not equal to blanks

Else

Select  on Category Code Y equal to @S,X

End

Else

Select Category Code Y equal to blanks

End

Else

Select Category Code Y equal to blanks

End

Subtract 1 from X

Subract 1 from Y

End Do


*/ Load Global/ Company level */


If @L,2 is not equal to zero
If @S,2 is not equal to blanks

If @S,2 is equal to '*'

Select on Company not equal to blanks

Else

Select  on Company equal to @S,2

End

Else

Select Company equal to '00000'

End

Else

Select Company equal to '00000'

End



3.If GetMoreRecords is not equal to blanks and/or after the above select is done


4.Move '1' to NoMoreRecords

If F3460LastRecord is not NULL

Call RetrieveDetailRecords (see below)

Else
If F34006TableHandle is not NULL

Call RetrieveWorkFileRecords (see below)

End
If NoMoreRecords is equal to '1'

Call RetrieveSummaryRecords (see below)

End
End


5.RetrieveSummaryRecords


If F3400LastRecord is not NULL

Re-fetch the record at the pointer F3400LastRecord and continue fetching records from that point

Else

Begin fetching records from the F3400 selected records

End


*/ Read all of the selected records doing the following for each  */


If a record was selected
If FirstPass is ' '

Move '1' to FirstPass

Save the keys in a set of F3400SaveKeys (not including date)

End


If the Key fields are equal to the F3400Save Key fields OR NoMoreRecords is equal to '1'


If Branch is not blank

If SaveChildKey is not equal to SGSFKE

Call RetreiveWorkFileRecords (see below)

End
Else
Call Load Period Buckets (see below)

End

Else

Call Load Data to Output (See Below)

Return to application
End

Else

*/ If there are no more records to select */

If Branch is blank
Call Load Data to Output (see below)

End
Set F3400LastRecord equal to NULL
Return to application 

End



6.RetreiveWorkFileRecords


If F34006TableHandle is equal to NULL
Select the records from the F34006 with the Child Key Off the F3400 record just read, the Branch ( 

if branch is not equal to '*' else select just with the child key)and the Forecast Type equal to 

the Type off the F3400

End


Fetch a record from the F34006 selected records and do the following:


If a record was fetched

Move SJSFKY to SaveChildKey

Call RetrieveDetailRecords (see Below)

Else
Release F34006TableHandle

End


7.RetreiveDetailRecords


If F3460LastRecord is equal to NULL

Select on the F3460 with the Item, Branch and Type off the F34006.  If Customer is in the 

hierarchy 

select on the AN8 from the F3400 record

The Requested date is between the BeginDate and EndDate

Fetch the F3460 record

Else

Re-fetch the record at the pointer in F3460LastRecord

End


*/ Read all of the selected records doing the following for each  */


If a record is selected

If F3460FirstPass is equal ' '

Move '1' to F3460FirstPass

Move the key fields to the F3460SaveKeys (not including date)

End


If the key fields are equal to the F3460SaveKeys

Call Load Period Buckets (see below) 

Else
Call Load Data to Output (see below)
Return to application 
End

Else

*/ If there are no more records to select */

Call Load Data to Output (see below)

Set F3460LastRecord equal to NULL
Return to application 
End


8.Load Period Buckets


Move ' ' to NoMoreRecords
Look up the Requested Date off the record in the PntrToDates array.  Find the first position that is 

greater than or equal to the date.  

If AmountQuantity is equal to '1'

Add the quantity off the record to the same position of the array of Period fields

Else

Add the amount off the record to the same position of the array of Period fields

End

Add 1 to the count in the PeriodCount array at the same position as the date


Load Data to Output

Move the array of period fields back out to the 54 periods
If any element in the PeriodCount array is greater than 1

Move '1' to MultipleDates

End

Move the saved ForecastType off the record to OutputType


*/ Load the Key Path Value */

If @L,1 is not equal to 0
Move GlobalText to KeyPathValue

Move the KeySegmentor to the next posistion of the KeyPathValue

End

If @L,2 is not equal to 0

Move the saved SGCO to KeyPathValue left justified

Move the KeySegmentor to the next position of the KeyPathValue

End


Move 01 to Y

Move 01 to X

Move the Saved LevelOne - the SavedLevelTen to a 10 big array (@C)

Do 10 times

If X is equal CustomerLevel

If SaveAddressNumber is equal to -99999999

Move BlankValueText to the next position of KeyPathValue

Else

Move the Saved AddressNumber to the next position of 

KeyPathValue

End

End

If @L,Y+2 is not equal to 0

If @C,Y is equal to *BLANK

Move BlankValueText to the next position of KeyPathValue

Else

Move @C,Y to the next position of KeyPathValue

End

Add 1 to Y

Move the KeySegmentor to the next position of the KeyPathValue

End

Add 1 to X

EndDo

If @L,14 is not equal to 0

Move the saved Short Item to the next posistion of KeyPathValue

Move the KeySegmentor to the next position of the KeyPathValue

End

If Branch is not blank

Move SaveBranch to the next position of the KeyPathValue

Move '1' to DetailRecord

Move ' ' to PlusMinus

Else

Move '+' to PlusMinus

If this is the bottom level of the hierarchy

Check if this record has any children in the F3460 table

If there are no children

Move ' ' to PlusMinus

End

End

End


*/ Load pointer to return to application */


Move the pointer to the selected F3400 records to F3400TableHandle

If F34006 was read move the pointer to the selected F34006 records to F34006TableHandle

If F3460 was read move the pointer to the selected F3460 records to F3460TableHandle

If the key changing caused return to the application move the pointer of the record just read 

(with th

Data Structure

D3400650 - F3400 Get Forecast By Type

Parameter NameData ItemData TypeReq/OptI/O/Both
szSummaryCodeKVERcharNONENONE

A user defined code (40/KY) that indicates the type of summary forecast.

szCompanyCOcharNONENONE

A code that identifies a specific organization, fund, or other reporting entity. The company code must already exist in the Company 
Constants table (F0010) and must identify a reporting entity that has a complete balance sheet. At this level, you can have intercompany 
transactions. Note: You can use company 00000 for default values such as dates and automatic accounting instructions. You cannot use company 00000 
for transaction entries.

szLevelOneKV01charNONENONE

The first key postion of the forecasting hierarchy.  The value in this field relates to the first level chosen in the forecasting constants.

szLevelTwoKV02charNONENONE

The second key postion of the forecasting hierarchy.  The value in this field relates to the second level chosen in the forecasting constants.

szLevelThreeKV03charNONENONE

The third key postion of the forecasting hierarchy.  The value in this field relates to the third level chosen in the forecasting constants.

szLevelFourKV04charNONENONE

The forth key postion of the forecasting hierarchy.  The value in this field relates to the fourth level chosen in the forecasting constants.

szLevelFiveKV05charNONENONE

The fifth key postion of the forecasting hierarchy.  The value in this field relates to the fifth level chosen in the forecasting constants.

szLevelSixKV06charNONENONE

The sixth key postion of the forecasting hierarchy.  The value in this field relates to the sixth level chosen in the forecasting constants.

szLevelSevenKV07charNONENONE

The seventh key postion of the forecasting hierarchy.  The value in this field relates to the seventh level chosen in the forecasting constants.

szLevelEightKV08charNONENONE

The eighth key postion of the forecasting hierarchy.  The value in this field relates to the eighth level chosen in the forecasting constants.

szLevelNineKV09charNONENONE

The ninth key postion of the forecasting hierarchy.  The value in this field relates to the ninth level chosen in the forecasting constants.

szLevelTenKV10charNONENONE

The tenth key postion of the forecasting hierarchy.  The value in this field relates to the tenth level chosen in the forecasting constants.

mnShortItemNumberITMMATH_NUMERICNONENONE

An inventory item number. The system provides three separate item numbers plus an extensive cross-reference capability to other item 
numbers (see data item XRT) to accommodate substitute item numbers, replacements, bar codes, customer numbers, supplier numbers, and 
so forth. The item numbers are as follows:   o Item Number (short) - An eight-digit, computer-assigned item number     o 2nd Item Number - The 
25-digit, free-form, user defined alphanumeric item number     o 3rd Item Number - Another 25-digit, free-form, user defined alphanumeric item 
number

mnAddressNumberAN8MATH_NUMERICNONENONE

A number that identifies an entry in the Address Book system, such as employee, applicant, participant, customer, supplier, tenant, or 
location.

szBranchMCUcharNONENONE

An alphanumeric code that identifies a separate entity within a business for which you want to track costs. For example, a business unit 
might be a warehouse location, job, project, work center, branch, or plant. You can assign a business unit to a document, entity, or person for 
purposes of responsibility reporting. For example, the system provides reports of open accounts payable and accounts receivable by 
business unit to track equipment by responsible department. Business unit security might prevent you from viewing information about business units 
for which you have no authority.

cGlobalLevelEV01charNONENONE

An option that specifies the type of processing for an event.

cCompanyLevelEV01charNONENONE

An option that specifies the type of processing for an event.

cCategory1LevelEV01charNONENONE

An option that specifies the type of processing for an event.

cCategory2LevelEV01charNONENONE

An option that specifies the type of processing for an event.

cCategory3LevelEV01charNONENONE

An option that specifies the type of processing for an event.

cCategory4LevelEV01charNONENONE

An option that specifies the type of processing for an event.

cCategory5LevelEV01charNONENONE

An option that specifies the type of processing for an event.

cCategory6LevelEV01charNONENONE

An option that specifies the type of processing for an event.

cCategory7LevelEV01charNONENONE

An option that specifies the type of processing for an event.

cCategory8LevelEV01charNONENONE

An option that specifies the type of processing for an event.

cCategory9LevelEV01charNONENONE

An option that specifies the type of processing for an event.

cCategory10LevelEV01charNONENONE

An option that specifies the type of processing for an event.

cItemLevelEV01charNONENONE

An option that specifies the type of processing for an event.

cCustomerLevelEV01charNONENONE

An option that specifies the type of processing for an event.

mnLevelOfCustomerMATH01MATH_NUMERICNONENONE

- - - Good Performance Low Value. 

szTypeOneTYPFcharNONENONE

A user defined code (34/DF) that indicates one of the following:     o The forecasting method used to calculate the numbers displayed about 
the item     o The actual historical information about the item 

szTypeTwoTYPF2charNONENONE

szTypeThreeTYPF3charNONENONE

szTypeFourTYPF4charNONENONE

szTypeFiveTYPF5charNONENONE

szTypeSixTYPF6charNONENONE

szTypeSevenTYPF7charNONENONE

szTypeEightTYPF8charNONENONE

szTypeNineTYPF9charNONENONE

szTypeTenTYPF10charNONENONE

szTypeElevenTYPF11charNONENONE

szTypeTwelveTYPF12charNONENONE

jdBeginDateDRQJJDEDATENONENONE

The date that an item is scheduled to arrive or that an action is scheduled for completion.

jdEndDateDRQJJDEDATENONENONE

The date that an item is scheduled to arrive or that an action is scheduled for completion.

idPtrToDatesGENLNGIDNONENONE

General purpose ID variable.

cGetMoreRecordsEV01charNONENONE

An option that specifies the type of processing for an event.

cAmountQuantityEV01charNONENONE

An option that specifies the type of processing for an event.

cKeySegmentorEV01charNONENONE

An option that specifies the type of processing for an event.

cAllItemsEV01charNONENONE

An option that specifies the type of processing for an event.

cAllCustomersEV01charNONENONE

An option that specifies the type of processing for an event.

cDetailRecordEV01charNONENONE

An option that specifies the type of processing for an event.

cNoMoreRecordsEV01charNONENONE

An option that specifies the type of processing for an event.

szPeriod1TQ01charNONENONE

Time Series Column 01. This column will hold Time Series Dates or Quantities.

szPeriod2TQ02charNONENONE

Time Series Column 02. This column will hold Time Series Dates or Quantities.

szPeriod3TQ03charNONENONE

Time Series Column 03. This column will hold Time Series Dates or Quantities.

szPeriod4TQ04charNONENONE

Time Series Column 04. This column will hold Time Series Dates or Quantities.

szPeriod5TQ05charNONENONE

Time Series Column 05. This column will hold Time Series Dates or Quantities.

szPeriod6TQ06charNONENONE

Time Series Column 06. This column will hold Time Series Dates or Quantities.

szPeriod7TQ07charNONENONE

Time Series Column 07. This column will hold Time Series Dates or Quantities.

szPeriod8TQ08charNONENONE

Time Series Column 08. This column will hold Time Series Dates or Quantities.

szPeriod9TQ09charNONENONE

Time Series Column 09. This column will hold Time Series Dates or Quantities.

szPeriod10TQ10charNONENONE

Time Series Column 10. This column will hold Time Series Dates or Quantities.

szPeriod11TQ11charNONENONE

Time Series Column 11. This column will hold Time Series Dates or Quantities.

szPeriod12TQ12charNONENONE

Time Series Column 12. This column will hold Time Series Dates or Quantities.

szPeriod13TQ13charNONENONE

Time Series Column 13. This column will hold Time Series Dates or Quantities.

szPeriod14TQ14charNONENONE

Time Series Column 14. This column will hold Time Series Dates or Quantities.

szPeriod15TQ15charNONENONE

Time Series Column 15. This column will hold Time Series Dates or Quantities.

szPeriod16TQ16charNONENONE

Time Series Column 16. This column will hold Time Series Dates or Quantities.

szPeriod17TQ17charNONENONE

Time Series Column 17. This column will hold Time Series Dates or Quantities.

szPeriod18TQ18charNONENONE

Time Series Column 18. This column will hold Time Series Dates or Quantities.

szPeriod19TQ19charNONENONE

Time Series Column 19. This column will hold Time Series Dates or Quantities.

szPeriod20TQ20charNONENONE

Time Series Column 20. This column will hold Time Series Dates or Quantities.

szPeriod21TQ21charNONENONE

Time Series Column 21. This column will hold Time Series Dates or Quantities.

szPeriod22TQ22charNONENONE

Time Series Column 22. This column will hold Time Series Dates or Quantities.

szPeriod23TQ23charNONENONE

Time Series Column 23. This column will hold Time Series Dates or Quantities.

szPeriod24TQ24charNONENONE

Time Series Column 24. This column will hold Time Series Dates or Quantities.

szPeriod25TQ25charNONENONE

Time Series Column 25. This column will hold Time Series Dates or Quantities.

szPeriod26TQ26charNONENONE

Time Series Column 26. This column will hold Time Series Dates or Quantities.

szPeriod27TQ27charNONENONE

Time Series Column 27. This column will hold Time Series Dates or Quantities.

szPeriod28TQ28charNONENONE

Time Series Column 28. This column will hold Time Series Dates or Quantities.

szPeriod29TQ29charNONENONE

Time Series Column 29. This column will hold Time Series Dates or Quantities.

szPeriod30TQ30charNONENONE

Time Series Column 30. This column will hold Time Series Dates or Quantities.

szPeriod31TQ31charNONENONE

Time Series Column 31. This column will hold Time Series Dates or Quantities.

szPeriod32TQ32charNONENONE

Time Series Column 32. This column will hold Time Series Dates or Quantities.

szPeriod33TQ33charNONENONE

Time Series Column 33. This column will hold Time Series Dates or Quantities.

szPeriod34TQ34charNONENONE

Time Series Column 34. This column will hold Time Series Dates or Quantities.

szPeriod35TQ35charNONENONE

Time Series Column 35. This column will hold Time Series Dates or Quantities.

szPeriod36TQ36charNONENONE

Time Series Column 36. This column will hold Time Series Dates or Quantities.

szPeriod37TQ37charNONENONE

Time Series Column 37. This column will hold Time Series Dates or Quantities.

szPeriod38TQ38charNONENONE

Time Series Column 38. This column will hold Time Series Dates or Quantities.

szPeriod39TQ39charNONENONE

Time Series Column 39. This column will hold Time Series Dates or Quantities.

szPeriod40TQ40charNONENONE

Time Series Column 40. This column will hold Time Series Dates or Quantities.

szPeriod41TQ41charNONENONE

Time Series Column 41. This column will hold Time Series Dates or Quantities.

szPeriod42TQ42charNONENONE

Time Series Column 42. This column will hold Time Series Dates or Quantities.

szPeriod43TQ43charNONENONE

Time Series Column 43. This column will hold Time Series Dates or Quantities.

szPeriod44TQ44charNONENONE

Time Series Column 44. This column will hold Time Series Dates or Quantities.

szPeriod45TQ45charNONENONE

Time Series Column 45. This column will hold Time Series Dates or Quantities.

szPeriod46TQ46charNONENONE

Time Series Column 46. This column will hold Time Series Dates or Quantities.

szPeriod47TQ47charNONENONE

Time Series Column 47. This column will hold Time Series Dates or Quantities.

szPeriod48TQ48charNONENONE

Time Series Column 48. This column will hold Time Series Dates or Quantities.

szPeriod49TQ49charNONENONE

Time Series Column 49. This column will hold Time Series Dates or Quantities.

szPeriod50TQ50charNONENONE

Time Series Column 50. This column will hold Time Series Dates or Quantities.

szPeriod51TQ51charNONENONE

Time Series Column 51. This column will hold Time Series Dates or Quantities.

szPeriod52TQ52charNONENONE

Time Series Column 52. This column will hold Time Series Dates or Quantities.

szPeriod53TQ53charNONENONE

Time Series Column 53. This column will hold Time Series Dates or Quantities.

szPeriod54TQ54charNONENONE

Time Series Column 54. This column will hold Time Series Dates or Quantities.

szKeyPathValueDS01charNONENONE

A free-form, 80-character text field.

szOutputTypeTYPFcharNONENONE

A user defined code (34/DF) that indicates one of the following:     o The forecasting method used to calculate the numbers displayed about 
the item     o The actual historical information about the item 

idF3400TableHandleGENLNGIDNONENONE

General purpose ID variable.

idF3460TableHandleGENLNGIDNONENONE

General purpose ID variable.

idF34006TableHandleGENLNGIDNONENONE

General purpose ID variable.

idF3400LastRecordGENLNGIDNONENONE

General purpose ID variable.

idF3460LastRecordGENLNGIDNONENONE

General purpose ID variable.

szSaveCompanyCOcharNONENONE

A code that identifies a specific organization, fund, or other reporting entity. The company code must already exist in the Company 
Constants table (F0010) and must identify a reporting entity that has a complete balance sheet. At this level, you can have intercompany 
transactions. Note: You can use company 00000 for default values such as dates and automatic accounting instructions. You cannot use company 00000 
for transaction entries.

szSaveLevelOneKV01charNONENONE

The first key postion of the forecasting hierarchy.  The value in this field relates to the first level chosen in the forecasting constants.

szSaveLevelTwoKV02charNONENONE

The second key postion of the forecasting hierarchy.  The value in this field relates to the second level chosen in the forecasting constants.

szSaveLevelThreeKV03charNONENONE

The third key postion of the forecasting hierarchy.  The value in this field relates to the third level chosen in the forecasting constants.

szSaveLevelFourKV04charNONENONE

The forth key postion of the forecasting hierarchy.  The value in this field relates to the fourth level chosen in the forecasting constants.

szSaveLevelFiveKV05charNONENONE

The fifth key postion of the forecasting hierarchy.  The value in this field relates to the fifth level chosen in the forecasting constants.

szSaveLevelSixKV06charNONENONE

The sixth key postion of the forecasting hierarchy.  The value in this field relates to the sixth level chosen in the forecasting constants.

szSaveLevelSevenKV07charNONENONE

The seventh key postion of the forecasting hierarchy.  The value in this field relates to the seventh level chosen in the forecasting constants.

szSaveLevelEightKV08charNONENONE

The eighth key postion of the forecasting hierarchy.  The value in this field relates to the eighth level chosen in the forecasting constants.

szSaveLevelNineKV09charNONENONE

The ninth key postion of the forecasting hierarchy.  The value in this field relates to the ninth level chosen in the forecasting constants.

szSaveLevelTenKV10charNONENONE

The tenth key postion of the forecasting hierarchy.  The value in this field relates to the tenth level chosen in the forecasting constants.

mnSaveShortItemITMMATH_NUMERICNONENONE

An inventory item number. The system provides three separate item numbers plus an extensive cross-reference capability to other item 
numbers (see data item XRT) to accommodate substitute item numbers, replacements, bar codes, customer numbers, supplier numbers, and 
so forth. The item numbers are as follows:   o Item Number (short) - An eight-digit, computer-assigned item number     o 2nd Item Number - The 
25-digit, free-form, user defined alphanumeric item number     o 3rd Item Number - Another 25-digit, free-form, user defined alphanumeric item 
number

mnSaveAddressNumberAN8MATH_NUMERICNONENONE

A number that identifies an entry in the Address Book system, such as employee, applicant, participant, customer, supplier, tenant, or 
location.

cPlusMinusEV01charNONENONE

An option that specifies the type of processing for an event.

cMultipleDatesEV01charNONENONE

An option that specifies the type of processing for an event.

cMonthlyVsWeeklyEV01charNONENONE

An option that specifies the type of processing for an event.

szSaveBranchMCUcharNONENONE

An alphanumeric code that identifies a separate entity within a business for which you want to track costs. For example, a business unit 
might be a warehouse location, job, project, work center, branch, or plant. You can assign a business unit to a document, entity, or person for 
purposes of responsibility reporting. For example, the system provides reports of open accounts payable and accounts receivable by 
business unit to track equipment by responsible department. Business unit security might prevent you from viewing information about business units 
for which you have no authority.

szSaveForecastTypeTYPFcharNONENONE

A user defined code (34/DF) that indicates one of the following:     o The forecasting method used to calculate the numbers displayed about 
the item     o The actual historical information about the item 

szGlobalTextDSC1charNONENONE

Brief information about an item; a remark or an explanation.

szBlankValueTextKV01charNONENONE

The first key postion of the forecasting hierarchy.  The value in this field relates to the first level chosen in the forecasting constants.

mnSaveChildKeySFKEMATH_NUMERICNONENONE

Summary Forecast Key

mnSaveDetailAddressAN8MATH_NUMERICNONENONE

A number that identifies an entry in the Address Book system, such as employee, applicant, participant, customer, supplier, tenant, or 
location.

szPeriodtotalTQ55charNONENONE

Time Series Column 55. This column will hold Time Series Dates or Quantities.

Related Functions

X4101 Validate and Retrieve Item Master

Related Tables

F3400 Forecast Summary File
F34006 Forecast Summary Work File
F3460 Forecast File
">Re-fetch the record at the pointer F3400LastRecord and continue fetching records from that point

Else

Begin fetching records from the F3400 selected records

End


*/ Read all of the selected records doing the following for each  */


If a record was selected
If FirstPass is ' '

Move '1' to FirstPass

Save the keys in a set of F3400SaveKeys (not including date)

End


If the Key fields are equal to the F3400Save Key fields OR NoMoreRecords is equal to '1'


If Branch is not blank

If SaveChildKey is not equal to SGSFKE

Call RetreiveWorkFileRecords (see below)

End
Else
Call Load Period Buckets (see below)

End

Else

Call Load Data to Output (See Below)

Return to application
End

Else

*/ If there are no more records to select */

If Branch is blank
Call Load Data to Output (see below)

End
Set F3400LastRecord equal to NULL
Return to application 

End



6.RetreiveWorkFileRecords


If F34006TableHandle is equal to NULL
Select the records from the F34006 with the Child Key Off the F3400 record just read, the Branch ( 

if branch is not equal to '*' else select just with the child key)and the Forecast Type equal to 

the Type off the F3400

End


Fetch a record from the F34006 selected records and do the following:


If a record was fetched

Move SJSFKY to SaveChildKey

Call RetrieveDetailRecords (see Below)

Else
Release F34006TableHandle