Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Customize Write

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
sakthisiga
Warnings : 1

New User


Joined: 11 Jun 2009
Posts: 60
Location: Chennai

PostPosted: Mon Oct 05, 2009 3:21 pm    Post subject: Customize Write
Reply with quote

Hi all,


I have a variable as:

Code:

    01 w01-var.
         05 itm1     pic x(2).
         05 itm2     pic x(2).
         05 itm3     pic x(2).


....
...


when i try to write;
Code:

   WRITE PM-RECORD FROM W01-VAR.
It will write all sub items into the file.



My question is, i want customize write that, i want to write itm1 and itm3 instead of writing all.


Can anyone help to write the particular values to file?
Back to top
View user's profile Send private message

Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Mon Oct 05, 2009 3:49 pm    Post subject:
Reply with quote

1. Do you understand what does 01 level mean in a file-description?
2. Please show if you get the values of all the "inputs", what do you expect in the output?

The way you have posed your question, muliple 01 levels can be your choice or define other variable as
Code:
01 w01-var-w.
         05 itm1     pic x(2)
         05 itm3     pic x(2).
and WRITE FROM this new variable.
Back to top
View user's profile Send private message
sakthisiga
Warnings : 1

New User


Joined: 11 Jun 2009
Posts: 60
Location: Chennai

PostPosted: Mon Oct 05, 2009 3:55 pm    Post subject:
Reply with quote

my actual variable declaration is

Code:


 01 W02-RECORD-VALUE.                                           
    05 W02-OUT-POLN               PIC X(10).                   
    05 FILLER                     PIC X(02) VALUE SPACES.       
    05 W02-OUT-DATE.                                           
       10 W02-DD                  PIC  9(2).                   
       10 FILLER                  PIC  X(01) VALUE '-'.         
       10 W02-MM                  PIC  9(2).                   
       10 FILLER                  PIC  X(01) VALUE '-'.         
       10 W02-YY                  PIC  9(4).                   
    05 FILLER                     PIC X(02) VALUE SPACES.       
    05 W02-PL-SUM                 PIC 9(07).                   
    05 FILLER                     PIC X(02) VALUE SPACES.       
    05 W02-PL-PREMIUM             PIC  9(07).                   
    05 FILLER                     PIC X(02) VALUE SPACES.       
    05 W02-PL-AMTREFUND           PIC  9(07).                   
    05 FILLER                     PIC X(02) VALUE SPACES.       
    05 W02-PL-AMT                 PIC  9(07).                   
    05 FILLER                     PIC X(22) VALUE SPACES.



My write code is

Code:


   WRITE PM-REC FROM W02-RECORD-VALUE 



here,

PM-REC will write all 05 level variable to file, but i don't want to write all, but by using the W02-RECORD-VALUE i want the customize write.

I want to write

05 W02-OUT-POLN PIC X(10).
05 FILLER PIC X(02) VALUE SPACES.
05 W02-OUT-DATE.
10 W02-DD PIC 9(2).
10 FILLER PIC X(01) VALUE '-'.
10 W02-MM PIC 9(2).
10 FILLER PIC X(01) VALUE '-'.
10 W02-YY PIC 9(4).
05 FILLER PIC X(02) VALUE SPACES.
05 W02-PL-PREMIUM PIC 9(07).
05 FILLER PIC X(02) VALUE SPACES.
05 W02-PL-AMT PIC 9(07).
05 FILLER PIC X(22) VALUE SPACES.


Can you please tell how to do that..
Back to top
View user's profile Send private message
sakthisiga
Warnings : 1

New User


Joined: 11 Jun 2009
Posts: 60
Location: Chennai

PostPosted: Mon Oct 05, 2009 3:56 pm    Post subject:
Reply with quote

my actual variable declaration is

Code:


 01 W02-RECORD-VALUE.                                           
    05 W02-OUT-POLN               PIC X(10).                   
    05 FILLER                     PIC X(02) VALUE SPACES.       
    05 W02-OUT-DATE.                                           
       10 W02-DD                  PIC  9(2).                   
       10 FILLER                  PIC  X(01) VALUE '-'.         
       10 W02-MM                  PIC  9(2).                   
       10 FILLER                  PIC  X(01) VALUE '-'.         
       10 W02-YY                  PIC  9(4).                   
    05 FILLER                     PIC X(02) VALUE SPACES.       
    05 W02-PL-SUM                 PIC 9(07).                   
    05 FILLER                     PIC X(02) VALUE SPACES.       
    05 W02-PL-PREMIUM             PIC  9(07).                   
    05 FILLER                     PIC X(02) VALUE SPACES.       
    05 W02-PL-AMTREFUND           PIC  9(07).                   
    05 FILLER                     PIC X(02) VALUE SPACES.       
    05 W02-PL-AMT                 PIC  9(07).                   
    05 FILLER                     PIC X(22) VALUE SPACES.



My write code is

Code:


   WRITE PM-REC FROM W02-RECORD-VALUE 



here,

PM-REC will write all 05 level variable to file, but i don't want to write all, but by using the W02-RECORD-VALUE i want the customize write.

I want to write
Code:

  05 W02-OUT-POLN               PIC X(10).                   
    05 FILLER                     PIC X(02) VALUE SPACES.       
    05 W02-OUT-DATE.                                           
       10 W02-DD                  PIC  9(2).                   
       10 FILLER                  PIC  X(01) VALUE '-'.         
       10 W02-MM                  PIC  9(2).                   
       10 FILLER                  PIC  X(01) VALUE '-'.         
       10 W02-YY                  PIC  9(4).                   
   05 FILLER                     PIC X(02) VALUE SPACES. 
   05 W02-PL-PREMIUM             PIC  9(07).                   
   05 FILLER                     PIC X(02) VALUE SPACES. 
   05 W02-PL-AMT                 PIC  9(07).                   
   05 FILLER                     PIC X(22) VALUE SPACES.


Can you please tell how to do that..
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8154
Location: East Dubuque, Illinois, USA

PostPosted: Mon Oct 05, 2009 4:12 pm    Post subject:
Reply with quote

You must define a group level variable somewhere in your program that contains just the fields you want to write, or you can use reference modification to move the fields you want to the FD 01 then write it.
Back to top
View user's profile Send private message
bipinpeter

Active User


Joined: 18 Jun 2007
Posts: 213
Location: Cochin/Kerala/India

PostPosted: Mon Oct 05, 2009 4:43 pm    Post subject:
Reply with quote

I think u can use RENAMES usage in cobol here.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8154
Location: East Dubuque, Illinois, USA

PostPosted: Mon Oct 05, 2009 4:49 pm    Post subject:
Reply with quote

How is RENAMES (which allows existing variables to be renamed) going to get rid of fields in the middle of the group level -- which is what the requirement is? RENAMES won't remove variables -- just change their name.
Back to top
View user's profile Send private message
jctgf
Currently Banned

Active User


Joined: 04 Nov 2006
Posts: 109

PostPosted: Mon Oct 05, 2009 8:31 pm    Post subject:
Reply with quote

Code:




01 W02-RECORD-VALUE.                                           
    05 W02-OUT-POLN               PIC X(10).                   
    05 FILLER                     PIC X(02) VALUE SPACES.       
    05 W02-OUT-DATE.                                           
       10 W02-DD                  PIC  9(2).                   
       10 FILLER                  PIC  X(01) VALUE '-'.         
       10 W02-MM                  PIC  9(2).                   
       10 FILLER                  PIC  X(01) VALUE '-'.         
       10 W02-YY                  PIC  9(4).                   
    05 FILLER                     PIC X(02) VALUE SPACES.       
    04 W02-VARIABLES.
      05 W02-PL-SUM                 PIC 9(07).                   
      05 FILLER                     PIC X(02) VALUE SPACES.       
      05 W02-PL-PREMIUM             PIC  9(07).                   
      05 FILLER                     PIC X(02) VALUE SPACES.       
      05 W02-PL-AMTREFUND           PIC  9(07).                   
      05 FILLER                     PIC X(02) VALUE SPACES.       
      05 W02-PL-AMT                 PIC  9(07).                   
      05 FILLER                     PIC X(22) VALUE SPACES.
    04 WX2-VARIABLES REDEFINES W02-VARIABLES.
      05 WX2-PL-PREMIUM     PIC  9(07).                   
      05 FILLER                          PIC X(02).
      05 WX2-PL-AMT            PIC  9(07).                   
      05 FILLER                          PIC X(__).


pls note the level 04 created for the WX2 variables.
move spaces to wx2-variables. then, just move pl-premium and pl-amt to WX2-PL-PREMIUM and WX2-PL-AMT (instead of W02). write the record the same way you are already doing.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Match two files using multiple keys a... santoshks1987 SYNCSORT 11 Fri Aug 18, 2017 10:50 am
No new posts Read two inputs and write into output... murali.andaluri DFSORT/ICETOOL 6 Wed Jul 26, 2017 7:35 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us