Page 1 of 1

How to get Signbit "C" in packed field of output file.

PostPosted: Fri Nov 13, 2009 12:19 am
by manisubbu
Hi All,

I am getting "F" in output file when i moved input packed field to output packed field. i am validating the packed field in the program and changing the value if it satisfy particular condition according to the requirement.In output file i am getting the correct value except sign bit.

For Example:
123F instead of 123C.


Could any one help me to resolve the issue.

Re: How to get Signbit "C" in packed field of output file.

PostPosted: Fri Nov 13, 2009 12:30 am
by Bill Dennis
Aren't both acceptable? Why do you desire an 'C' ?

Re: How to get Signbit "C" in packed field of output file.

PostPosted: Fri Nov 13, 2009 4:05 am
by dick scherrer
Hello and welcome to the forum,

Is this happening in your own code or some utility (such as the sort)?

If this happens in your code, change the definition of the output field to be 9(n) instead of s9(n).

If this is a coding question or a utility question, we can move the topic to the appropriate part of the forum.

Re: How to get Signbit "C" in packed field of output file.

PostPosted: Thu Nov 19, 2009 9:42 pm
by manisubbu
It is coding question. I am writing Easytrieve program to change pack values in the input file to some other pack values if the input records matches specific condition.

For Example:

If the input file contains two types of record such as Type A and Type B. I need to change 5th field of the B type record (which is the packed variable) when it satisfies some condition otherwise I need to add the records in output file.

Sample Code:

File1 = Input file
Input –record 80 A

File2 = Output file
Output –record 80 A

GET File1
Do while until EOF file1
Move input-Record to output-Record
IF record type = ‘a’
Nop
Else
If record type = ‘b’
If 3rd pos = ‘c’
5th pos = packed value
End-if
End-if
End-if
Put File2
Get file1
End-Do

Case: 1
If B type records satisfy the above condition. I am passing packed value (50) to that field.
Case: 2
If B type records does not satisfy the above condition. I am writing the records to output file without changing the pack value.

Output:
For Case 1: I am getting ‘F’ in packed field
For Case 2: I am getting ‘C’ in packed fields which is same as input file.

Note: The packed field which I am changing contains “F” in the sign bit remaining Pack field Contains “C” in the sign bit.

Re: How to get Signbit "C" in packed field of output file.

PostPosted: Thu Nov 19, 2009 10:19 pm
by Bill Dennis
Perhaps Eztrieve has an option to choose which sign to use for PD data? Check the manual.

Re: How to get Signbit "C" in packed field of output file.

PostPosted: Fri Nov 20, 2009 2:40 am
by dick scherrer
Hello,

How is the problem field defined?

Easytrieve uses the F-sign for unsigned data and the C-sign for signed data. There are some rules that are not obvious - for example if a numeric field has no decimal places it is assumed to be unsigned. . .