MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Easytrieve - PIC clause

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Tue Apr 25, 2006 5:10 pm    Post subject: Easytrieve - PIC clause Reply with quote

Hi,

I have a VSAM file with three fields LSM-LPMTDT, LSM-INTCOLL1098 and LSM-LATECHGCOLL1098.

The PIC clause of these 3 fields are as below.

Code:

05  LSM-LPMTDT           PIC S9(07)     COMP-3.
03  LSM-INTCOLL1098          PIC S9(11)V99  COMP-3.
03  LSM-LATECHGCOLL1098      PIC S9(11)V99  COMP-3.


Please let me know how to define these fields in the Easytrieve code.


My second question is below.

The value of LSM-LPMTDT in the VSAM file for a record is 0040715.
004 - year
07 - month
15 - date.

I want to update LSM-INTCOLL1098 and LSM-LATECHGCOLL1098 to ZERO if the year is 004. How can I check this condition in the code.

Please help me with this.
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Tue Apr 25, 2006 7:37 pm    Post subject: Reply with quote

Quote:

05 LSM-LPMTDT PIC S9(07) COMP-3.
03 LSM-INTCOLL1098 PIC S9(11)V99 COMP-3.
03 LSM-LATECHGCOLL1098 PIC S9(11)V99 COMP-3.

Please let me know how to define these fields in the Easytrieve code.



Nothing different. You Just need to calculate the total no: of bytes using the formula

Code:

PIC S9(n) COMP-3      = (n+1)/2 and the format is P
PIC S9(x)V9(y) COMP-3 = PIC S9(n) where n=x+y


So in your case S9(07) Comp-3 = (7+1)/2 = 4 bytes since there are no decimals you code 0 for decimals.
i.e
Code:

 4 p 0


PIC S9(11)V99 = (11+2+1)/2 = 7 bytes and you have 2 decimal digits you code 2 for decimals.

i.e
Code:

  7 P 2



so finally this is how your fields need to defined.
Code:


LSM-LPMTDT              Pos 4 P 0
LSM-INTCOLL1098         Pos 7 P 2
LSM-LATECHGCOLL1098     Pos 7 P 2

where pos = position of the field in the file


Quote:

I want to update LSM-INTCOLL1098 and LSM-LATECHGCOLL1098 to ZERO if the year is 004. How can I check this condition in the code.


Define a working storage field as follows

Code:

W-LPMTDT              W 08 A     
  W-FLD1  W-LPMTDT      04 N 0   
  W-FLD2  W-LPMTDT  +4  02 N 0   
  W-FLD3  W-LPMTDT  +6  02 N 0   


and check the w-fld1
Code:

W-LPMTDT  = LSM-LPMTDT     

IF W-FLD1 = 4             
   LSM-INTCOLL1098     = 0   
   LSM-LATECHGCOLL1098 = 0   
END-IF


Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Tue Apr 25, 2006 8:04 pm    Post subject: Reply with quote

Kolusu,

Thanks a lot for the quick help.
It really helpmed me.
Once agian thanks.
Back to top
View user's profile Send private message Send e-mail
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Wed Apr 26, 2006 4:31 pm    Post subject: Reply with quote

Hi,

As per the above discussion I have one more query.
I am trying to copy all the records from input VSAM file to an other VSAM file if the year is 004. I tried with the following code.


Code:

FILE LNMAST
IN-REC                            1      1700  A
LSM-LPMTDT                        694    4     P  0
*
FILE OUTPUT
OUT-REC                           1      1700  A
******************************************************************
W-LPMTDT              W 08 A
  W-FLD1  W-LPMTDT      04 N 0
  W-FLD2  W-LPMTDT  +4  02 N 0
  W-FLD3  W-LPMTDT  +6  02 N 0
*
JOB INPUT LNMAST
   MOVE SPACES TO OUT-REC
   W-LPMTDT  = LSM-LPMTDT
   IF W-FLD1 = 4
    OUT-REC = IN-REC
    PUT OUTPUT
   END-IF


But I am getting abend S213. Could somebody please help me with this.
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Apr 26, 2006 5:23 pm    Post subject: Reply with quote

Quote:

I am trying to copy all the records from input VSAM file to an other VSAM file if the year is 004. I tried with the following code.

vkphani,

Your File definitions does not show that your are copying a vsam file. You need to add VS after file name on File statement.

Code:

FILE LNMAST VS

FILE OUTPUT VS


Also make sure that your OUTPUT vsam cluster is defined with REUSE option.

Hope this helps...

Cheers

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Wed Apr 26, 2006 7:47 pm    Post subject: Reply with quote

Kolusu,

Thanks a lot for the quick help.
The suggestion worked well.
Once agian thanks.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group