I have a little bit different take on your post than Rich. It kinda sounds like your wanting to stay within a single output card to do all the work. I do this kind of thing often and I have a utility type tree that I built for chunking off files in whatever kind of grouping I like. Basically it is layers of repeating records with a blob text item at it's heart with an optional Key field so that I can identify my groups if necessary for naming etc. Structure looks like this... You can use delimiters at group definitions however you'd have to remember to strip them off in a PUT function depending on how you use it.
Grp: LabelList(s)
itm: label (1:1)
grp: List(s)
itm: blob(s)
From this structure, I can then index as many or as few groups as I need to accomplish my tasks - so in your case - I would maybe just have my output card point to the group "LabelList" and have 3 indexed instances and set the remaining (s) to NONE. Then make a functional map that will PACKAGE the records you want into a blob and then do the PUT function on the inside. Depending on how you need to group the records that could be using EXTRACT for a particular criteria or use PACKGE(CHOOSE Record 1) + PACKAGE(CHOOSE(record 2)) to get the desired payload for the PUT and pass in any other items needed for file naming etc.
| 1-1# PutFiles (LabelList Data) |
| Output |
Rule |
| PutFiles |
|
| LabelList [1] |
|
| Label Field |
="Records1&2" |
| List (s) |
=f_PutRecs(PACKAGE(CHOOSE(Record, 1)) + PACKAGE(CHOOSE(Record, 2)), filename) |
| LabelList [2] |
|
| Label Field |
="Records3&4" |
| List (s) |
=f_PutRecs(PACKAGE(CHOOSE(Record, 3)) + PACKAGE(CHOOSE(Record, 4), filename) |
| LabelList [3] |
|
| Label Field |
="Record5" |
| List (s) |
=f_PutRecs(PACKAGE(CHOOSE(Record, 5)), filename) |
| LabelList [s] |
=NONE |
Then inside the f_PutRecs functional map do the PUT function with the packaged blob you've passed in on an index of you blob.
| 1-1# PutRecs (List Data) |
| Output |
Rule |
| PutRecs |
|
| List |
|
|
blob Field [1]
|
=PUT("File", filename, PACKAGE(input)) |
| blob Field (s) |
=NONE |
I would wrap the PUT in a VALID to catch errors/deal with errors too. But if you're limited on cards you can use for output this is one way to do it all in a single output card and write multiple outputs.
Happy mapping!
------------------------------
Lisa Edwards
Software Engineer / Subject Matter Expert
Rainbow Data Systems, Inc
------------------------------