IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

KSDS IAM file processing with ICETOOL


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
madmartinsonxx

New User


Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

PostPosted: Wed Mar 21, 2012 11:59 pm
Reply with quote

I am in a shop where all of the databases are set up with KSDS IAM organization and 'modeled' to appear just like an IMS database. There is some inhouse software here where they have acheived the functionality of IMS commands like 'GN', 'GHU' against these DBs. Example follows:
So the base in this case is:
Code:

Command ===>                                                             Scroll    CSR 
Key    'AT0000101      1'            Type    KSDS IAM    RBA    <IAM FILE>              Format    SNGL
                                                        Top Line is    1       of    165   
Current 01:    ADROOT                                                  Length    341   
Field             Picture    Typ  Len   Data                                   
ADROOT-VK-ADV-NO  X(9)       AN     9      AT0000101                                 
FILLER            X(6)       AN     6                                               
ADROOT-VK-REC-TYPE                                                             
                  X          AN     1      1                                         
ADROOT-WHOFSUP    XX         AN     2      AT                                       
ADROOT-NUMBER     99999      ZD     5           1                                   
ADROOT-PAGE       99         ZD     2        1                                       
ADROOT-STATUS     99         ZD     2       30                                       
ADROOT-ADDDATE    S9(7)      PD     4       1120319                                 
ADROOT-PCKDATE    S9(7)      PD     4             0                                 
ADROOT-WEIGHT     S9(6)V999  PD     5            0.800                               
ADROOT-BASEIND    X          AN     1      0                                         
ADROOT-SLCRIT     S9(7)      PD     4        109605                                 
ADROOT-TOTORD     S9(7)      PD     4             1                                 
ADROOT-INVMU      XX         AN     2                                               


and a segment is:
Code:

                                                        Top Line is    1       of    100   
Current 01:    ADLINE                                                  Length    391   
Field             Picture    Typ  Len   Data                                   
ADLINE-VK-ADV-NO  X(9)       AN     9      AT0000101                                 
ADLINE-VK-KEYCOM  X          AN     1      2                                         
ADLINE-VK-SEQ-NO  X(5)       AN     5      00100                                     
ADROOT-VK-REC-TYPE                                                             
                  X          AN     1      2                                         
ADLINE-CSEQNO     9(5)       ZD     5         100                                   
ADLINE-ORDMU      XX         AN     2      US                                       
ADLINE-ORDNO      S9(7)      PD     4       7182117                                 
ADLINE-SEQNO      S9(7)      PD     4          2200                                 
ADLINE-ORDTYPE    99         ZD     2        6                                       
ADLINE-ORDPART    X(21)      AN    21       20870709                                 
ADLINE-RECTYPE    9          ZD     1       1                                       
ADLINE-ORDQTY     S9(7)      PD     4             0                                 
ADLINE-SUPPART    X(21)      AN    21       20870709                                 
ADLINE-USER       X(20)      AN    20      ~+111BEL
 


I am currently working with the ADLINE database (above). I posted a question yesterday which frank so kindly replied too. In that post was the INREC command
Code:

INREC PARSE=(%=(ENDBEFR=C','),%01=(FIXLEN=4)), 
        BUILD=(%01,PD,TO=ZD)   

which got me to the first field in the ADLINE db ( turned out to be 9 and not 4 bytes). After fiddling around with the JCL and several errors I found ( with the help of QW ( bless it's soul)) the following command would get me to the first field in the IAM file and gave a report of 8 bazillion of them ( had to purge the job). But, it worked.
Code:

//TOOLIN DD *                                 
  MODE STOP                                   
  COPY FROM(IN01)  TO(OUT01) USING(CTL1)       
//CTL1CNTL DD *                               
*                                             
  RECORD TYPE=V                               
  SORT FIELDS=COPY,STOPAFT=5000               
  INCLUDE COND=(16,1,EQ,C'2'),FORMAT=BI       
  INREC PARSE=(%01=(ENDBEFR=C',',FIXLEN=9)),   
        BUILD=(1,4,%01)                       

I didn't know what the ENDBEFR=C',' and the 1,4 in
BUILD=(1,4,%01) were and still that is kinda vague.

my Question is:
since I got to the 1st data field by using the ENDBEFR and the BUILD=(1,4 am i faced with using that exact combination when getting the next 'n' of fields for output or can I just end that noise and continue with FIXLEN=(%02 ?

the output that I need is just the data in the fields in a readable format. I can figure that one out, I just need the direction to get the rest of the data in the record one field at a time.
Thanks
[/code]
Back to top
View user's profile Send private message
elango_K

New User


Joined: 18 Aug 2011
Posts: 44
Location: India

PostPosted: Thu Mar 22, 2012 12:07 am
Reply with quote

Quote:

didn't know what the ENDBEFR=C',' and the 1,4 in
BUILD=(1,4,%01) were and still that is kinda vague.


Can you please have a look at PARSE command in the manual.

This will clearly clarify your query.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Thu Mar 22, 2012 1:19 am
Reply with quote

Madmartionsonxx, you've used PARSE BEFoRe.

The 1,4 is for the RDW as you have a variable-length-record dataset. You'll only need that once, and exactly where it is at the moment.
Back to top
View user's profile Send private message
madmartinsonxx

New User


Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

PostPosted: Thu Mar 22, 2012 1:33 am
Reply with quote

Thank you sir Woodger. Ya i have parsed me brains out. the 1,4 was the stickler here for me.
Thank you
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Mar 22, 2012 1:40 am
Reply with quote

Quote:
I didn't know what the ENDBEFR=C',' and the 1,4 in
BUILD=(1,4,%01) were and still that is kinda vague.


ENDBEFR=C',' says to stop extracting the field at the first comma.

BUILD=(1,4,%01) specifes the output records should have the RDW (required for VB records) and the data extracted into the %01 parsed field.

However, I'm a little confused. The structure you show for the database seems to have fixed-length fields, not delimited fields. For example, the first few fields of your record would look like this according to your structure:

Code:

AT0000101      1AT000010130     


Those are NOT delimited fields and don't require PARSE to handle.

For delimited fields requiring PARSE, I would expect something like this:

Code:

AT0000101,,1,AT,00001,01,30     


Perhaps my answer was to a question you didn't ask correctly?

Perhaps you should start over and explain exactly what you're trying to do so I can help you do it correctly.

Please show an example of the records in your input file (relevant fields only) and what you expect for output. If the fields are fixed length, show that in the example. If the fields are delimited, show that in the example. Explain the "rules" for getting from input to output. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input file.
Back to top
View user's profile Send private message
madmartinsonxx

New User


Joined: 10 Dec 2010
Posts: 96
Location: Massachusetts

PostPosted: Thu Mar 22, 2012 2:11 am
Reply with quote

son of a gun, i have been misled (new here ).

3.2 shows

Code:

Data Set Name . . . . :    VF.SPM.VADVNDB                                     
                                                                              
General Data                                 Current Allocation                   
    Management class . . :    **None**              Allocated cylinders :    2,841     
    Storage class  . . . :    **None**              Allocated extents . :    3         
     Volume serial . . . :    POP007    +                                                 
     Device type . . . . :    3390                                                      
    Data class . . . . . :    **None**                                                  
     Organization  . . . :    PS                   Current Utilization                 
     Record format . . . :    F                     Used cylinders  . . :    2,841     
     Record length . . . :    0                     Used extents  . . . :    3         
     Block size  . . . . :    13682                                                    
     1st extent cylinders:    777                                                    
     Secondary cylinders :    300               Dates                               
     Data set name type  :                          Creation date . . . :    1998/04/05
     SMS Compressible. . :    NO                    Referenced date . . :    2012/03/21
                                                    Expiration date . . :    ***None***


Input is fixed Length not delimited:
Code:

Key    AT00002012001002              Type    KSDS IAM    RBA    <IAM FILE>              Format    SNGL
                                                        Top Line is    1       of    100   
Current 01:    ADLINE                                                  Length    391   
Field             Picture    Typ  Len   Data                                   
ADLINE-VK-ADV-NO  X(9)       AN     9      AT0000201                                 
ADLINE-VK-KEYCOM  X          AN     1      2                                         
ADLINE-VK-SEQ-NO  X(5)       AN     5      00100                                     
ADROOT-VK-REC-TYPE                                                             
                  X          AN     1      2                                         
ADLINE-CSEQNO     9(5)       ZD     5         100                                   
ADLINE-ORDMU      XX         AN     2      US                                       
ADLINE-ORDNO      S9(7)      PD     4       7185482                                 
ADLINE-SEQNO      S9(7)      PD     4           200                                 
ADLINE-ORDTYPE    99         ZD     2        2                                       
ADLINE-ORDPART    X(21)      AN    21       21633320                                 
ADLINE-RECTYPE    9          ZD     1       1                                       
ADLINE-ORDQTY     S9(7)      PD     4             0                                 
ADLINE-SUPPART    X(21)      AN    21       21633320                                 
ADLINE-USER       X(20)      AN    20   

Starting and ending pos:


Code:

Key    AT00001012001002                               Col    1          Insert Length    391   
       <===+====10===+>---2----+----3----+----4----+----5----+----6----+----7-
=SUPP     AT0000101200100200100US.b.@....06 20870709            1.... 20870709   


Output :

Code:

AT00001012001002   100US 7182117    2200  6 20870709 1       0    
 


think i got 'em all.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Mar 22, 2012 2:47 am
Reply with quote

Ok, so now you have to decide on/explain the rules for getting from input to output.

The AN fields will display as characters so I presume there will be no changes needed there.

The ZD fields will by default display as numeric with leading zeros, e.g. 00100 for a 5-byte ZD field. Do you want them displayed some other way? If so, tell me how you want them displayed (leading spaces?).

The PD fields look suspicious to me. For example, you have:

Code:

ADLINE-ORDNO      S9(7)      PD     4       7185482                                 


S9(7) would be a 7-byte ZD field, not a 4-byte PD field. S9(7) COMP-3 would be a 4-byte PD field. In hex, a 4-byte PD field would be X'7185482C'. Is that what the fields labelled as PD actually look like in the input file? What do you want displayed in the output file for these fields (leading zeros, leading spaces, ?).

Here's an example with leading spaces displayed to get you started:

Code:

   OPTION COPY
   INREC BUILD=(1,16,17,5,ZD,EDIT=(IIIIT),22,2,
       20,4,PD,EDIT=(IIIIIIT),...
       ...)
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 4
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top